﻿
function getsize() {
    var n = 0,
        t = 0;
    return typeof window.innerHeight == "number" ? (n = window.innerHeight, t = window.innerWidth) : document.documentElement && document.documentElement.clientHeight ? (n = document.documentElement.clientHeight, t = document.documentElement.clientWidth) : document.body && document.body.clientHeight && (n = document.body.clientHeight, t = document.body.clientWidth),
    {
        width: t,
        height: n
    }
}
var JSON, utils, com, easyuifix;
JSON || (JSON = {}),


function () {
    "use strict";

    function i(n) {
        return n < 10 ? "0" + n : n
    }
    function f(n) {
        return o.lastIndex = 0,
        o.test(n) ? '"' + n.replace(o, function (n) {
            var t = s[n];
            return typeof t == "string" ? t : "\\u" + ("0000" + n.charCodeAt(0).toString(16)).slice(-4)
        }) + '"' : '"' + n + '"'
    }
    function r(i, e) {
        var s, l, h, a, v = n,
            c, o = e[i];
        o && typeof o == "object" && typeof o.toJSON == "function" && (o = o.toJSON(i)),
        typeof t == "function" && (o = t.call(e, i, o));
        switch (typeof o) {
            case "string":
                return f(o);
            case "number":
                return isFinite(o) ? String(o) : "null";
            case "boolean":
            case "null":
                return String(o);
            case "object":
                if (!o) return "null";
                if (n += u, c = [], Object.prototype.toString.apply(o) === "[object Array]") {
                    for (a = o.length, s = 0; s < a; s += 1) c[s] = r(s, o) || "null";
                    return h = c.length === 0 ? "[]" : n ? "[\n" + n + c.join(",\n" + n) + "\n" + v + "]" : "[" + c.join(",") + "]",
                    n = v,
                    h
                }
                if (t && typeof t == "object") for (a = t.length, s = 0; s < a; s += 1) typeof t[s] == "string" && (l = t[s], h = r(l, o), h && c.push(f(l) + (n ? ": " : ":") + h));
                else for (l in o) Object.prototype.hasOwnProperty.call(o, l) && (h = r(l, o), h && c.push(f(l) + (n ? ": " : ":") + h));
                return h = c.length === 0 ? "{}" : n ? "{\n" + n + c.join(",\n" + n) + "\n" + v + "}" : "{" + c.join(",") + "}",
                n = v,
                h
        }
    }
    typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function () {
        return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + i(this.getUTCMonth() + 1) + "-" + i(this.getUTCDate()) + "T" + i(this.getUTCHours()) + ":" + i(this.getUTCMinutes()) + ":" + i(this.getUTCSeconds()) + "Z" : null
    }, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function () {
        return this.valueOf()
    });
    var e = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        o = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        n, u, s = {
            "\b": "\\b",
            "\t": "\\t",
            "\n": "\\n",
            "\f": "\\f",
            "\r": "\\r",
            '"': '\\"',
            "\\": "\\\\"
        },
        t;
    typeof JSON.stringify != "function" && (JSON.stringify = function (i, f, e) {
        var o;
        if (n = "", u = "", typeof e == "number") for (o = 0; o < e; o += 1) u += " ";
        else typeof e == "string" && (u = e);
        if (t = f, f && typeof f != "function" && (typeof f != "object" || typeof f.length != "number")) throw new Error("JSON.stringify");
        return r("", {
            "": i
        })
    }),
    typeof JSON.parse != "function" && (JSON.parse = function (n, t) {
        function r(n, i) {
            var f, e, u = n[i];
            if (u && typeof u == "object") for (f in u) Object.prototype.hasOwnProperty.call(u, f) && (e = r(u, f), e !== undefined ? u[f] = e : delete u[f]);
            return t.call(n, i, u)
        }
        var i;
        if (n = String(n), e.lastIndex = 0, e.test(n) && (n = n.replace(e, function (n) {
            return "\\u" + ("0000" + n.charCodeAt(0).toString(16)).slice(-4)
        })), /^[\],:{}\s]*$/.test(n.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return i = eval("(" + n + ")"),
            typeof t == "function" ? r({
                "": i
            }, "") : i;
        throw new SyntaxError("JSON.parse");
    })
} (),
utils = {},
utils.formatString = function () {
    for (var t, n = 1; n < arguments.length; n++) t = new RegExp("\\{" + (n - 1) + "\\}", "gm"),
    arguments[0] = arguments[0].replace(t, arguments[n]);
    return arguments[0]
},
utils.formatDate = function (n, t) {
    var i, r, u;
    if (!n) return "";
    i = n,
    typeof n == "string" && (i = n.indexOf("/Date(") > -1 ? new Date(parseInt(n.replace("/Date(", "").replace(")/", ""), 10)) : new Date(Date.parse(n.replace(/-/g, "/").replace("T", " ").split(".")[0]))),
    r = {
        "M+": i.getMonth() + 1,
        "d+": i.getDate(),
        "h+": i.getHours(),
        "m+": i.getMinutes(),
        "s+": i.getSeconds(),
        "q+": Math.floor((i.getMonth() + 3) / 3),
        S: i.getMilliseconds()
    },
    /(y+)/.test(t) && (t = t.replace(RegExp.$1, (i.getFullYear() + "").substr(4 - RegExp.$1.length)));
    for (u in r) new RegExp("(" + u + ")").test(t) && (t = t.replace(RegExp.$1, RegExp.$1.length == 1 ? r[u] : ("00" + r[u]).substr(("" + r[u]).length)));
    return t
},
utils.formatNumber = function (n, t) {
    var c, f;
    if (n == null) return n;
    var o = n ? n.toString().split(".") : ["0"],
        s = t ? t.split(".") : [""],
        i = "",
        u = o[0],
        e = s[0],
        r = u.length - 1,
        h = !1;
    for (f = e.length - 1; f >= 0; f--) switch (e.substr(f, 1)) {
        case "#":
            r >= 0 && (i = u.substr(r--, 1) + i);
            break;
        case "0":
            i = r >= 0 ? u.substr(r--, 1) + i : "0" + i;
            break;
        case ",":
            h = !0,
            i = "," + i
    }
    if (r >= 0) if (h) for (c = u.length; r >= 0; r--) i = u.substr(r, 1) + i,
    r > 0 && (c - r) % 3 == 0 && (i = "," + i);
    else i = u.substr(0, r + 1) + i;
    for (i = i + ".", u = o.length > 1 ? o[1] : "", e = s.length > 1 ? s[1] : "", r = 0, f = 0; f < e.length; f++) switch (e.substr(f, 1)) {
        case "#":
            r < u.length && (i += u.substr(r++, 1));
            break;
        case "0":
            i += r < u.length ? u.substr(r++, 1) : "0"
    }
    return i.replace(/^,+/, "").replace(/\.$/, "")
},
utils.toTreeData = function (n, t, i, r) {
    for (var s = [], h = {}, c = (n || []).length, e, o, f, u = 0; u < c; u++) h[n[u][t]] = n[u];
    for (e = 0; e < c; e++) o = n[e],
    f = h[o[i]],
    f ? (f[r] || (f[r] = []), f[r].push(o)) : s.push(o);
    return s
},
utils.eachTreeRow = function (n, t) {
    for (var i in n) t(n[i]),
    n[i].children && utils.eachTreeRow(n[i].children, t)
},
utils.fnValueToText = function (n, t, i) {
    var u = {},
        r, f;
    for (r in n) u[n[r][t || "value"]] = n[r][i || "text"];
    return f = function (n) {
        return u[n]
    }
},
utils.compareObject = function (n, t) {
    var r = function (n) {
        var t = 0;
        for (k in n) n.hasOwnProperty(k) && t++;
        return t
    },
        i;
    if (typeof n != typeof t) return !1;
    if (typeof n == "function") return n.toString() === t.toString();
    if (n instanceof Object && t instanceof Object) {
        if (r(n) !== r(t)) return !1;
        i = !0;
        for (k in n) if (i = utils.compareObject(n[k], t[k]), !i) return !1;
        return !0
    }
    return n === t
},
utils.minusArray = function (n, t) {
    var u = [],
        i, r, f;
    for (i in n) {
        r = !0;
        for (f in t) if (utils.compareObject(n[i], t[f])) {
            r = !1;
            break
        }
        r && u.push(n[i])
    }
    return u
},
utils.diffrence = function (n, t, i, r) {
    var e = {},
        i = i || [],
        r = r || [],
        o = {},
        s = {},
        f, u;
    for (f in i) o[i[f]] = !0;
    for (f in r) s[r[f]] = !0;
    for (u in n) !s[u] && (n[u] != t[u] || o[u]) && (e[u] = n[u]);
    return e
},
utils.filterProperties = function (n, t, i) {
    var r, o, f, u, e;
    if (n instanceof Array || Object.prototype.toString.call(n) === "[object Array]") {
        r = [];
        for (f in n) r.push(utils.filterProperties(n[f], t, i))
    } else if (typeof n == "object") if (r = {}, i) {
        o = {};
        for (f in t) o[t[f]] = !0;
        for (u in n) o[u] || (r[u] = n[u])
    } else for (u in t) e = t[u].split(" as "),
    r[e[1] || e[0]] = n[e[0]];
    else r = n;
    return r
},
utils.copyProperty = function (n, t, i, r) {
    var f, u;
    if (n instanceof Array || Object.prototype.toString.call(n) === "[object Array]") for (f in n) utils.copyProperty(n[f], t, i);
    else if (typeof n == "object") if (t instanceof Array || Object.prototype.toString.call(t) === "[object Array]") for (u in t) utils.copyProperty(n, t[u], i[u]);
    else typeof t == "string" && (n[i] && r || !n[i]) && (n[i] = n[t]);
    return n
},
utils.clearIframe = function (n) {
    var t = $("iframe", n).add(parent.$("iframe", n));
    t.length > 0 && (t[0].contentWindow.document.write(""), t[0].contentWindow.close(), t.remove(), $.browser.msie && CollectGarbage())
},
utils.getThisIframe = function () {
    var n, t, i;
    if (!parent || (n = parent.document.getElementsByTagName("iframe"), n.length == 0)) return null;
    for (t = 0; t < n.length; ++t) if (i = n[t], i.contentWindow === self) return i;
    return null
},
utils.functionComment = function (n) {
    return n.toString().replace(/^.*\r?\n?.*\/\*|\*\/([.\r\n]*).+?$/gm, "")
},
utils.uuid = function () {
    var n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
    return function (t, i) {
        var f = n,
            u = [],
            o = Math.random,
            e, r;
        if (i = i || f.length, t) for (r = 0; r < t; r++) u[r] = f[0 | o() * i];
        else for (u[8] = u[13] = u[18] = u[23] = "-", u[14] = "4", r = 0; r < 36; r++) u[r] || (e = 0 | o() * 16, u[r] = f[r == 19 ? e & 3 | 8 : e & 15]);
        return u.join("").toLowerCase()
    }
} (),
utils.getRequest = function (n, t) {
    var t = t || window.location.href,
        r = {},
        u, i;
    if (t.indexOf("?") != -1) for (u = t.split("?")[1], strs = u.split("&"), i = 0; i < strs.length; i++) r[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
    return r[n]
},
com = {},
com.vm = {},
com.formatDate = function (n) {
    return utils.formatDate(n, "yyyy-MM-dd")
},
com.formatTime = function (n) {
    return utils.formatDate(n, "yyyy-MM-dd hh:mm:ss")
},
com.formatMoney = function (n) {
    var t = n < 0 ? "-" : "";
    return t + utils.formatNumber(Math.abs(n), "#,##0.00")
},
com.formatCheckbox = function (n) {
    var t = (n || "false").toString() == "true";
    return utils.formatString('<img value={0} src="/Content/images/{1}"/>', t, t ? "checkmark.gif" : "checknomark.gif")
},
com.message = function (n, t, i) {
    switch (n) {
        case "success":
            if (parent == window) return alert(t);
            parent.$("#notity").jnotifyAddMessage({
                text: t,
                permanent: !1
            });
            break;
        case "error":
            if (parent == window) return alert(t);
            parent.$.messager.alert("错误", t);
            break;
        case "warning":
            if (parent == window) return alert(t);
            parent.$("#notity").jnotifyAddMessage({
                text: t,
                permanent: !1,
                type: "warning"
            });
            break;
        case "information":
            parent.$.messager.show({
                title: "消息",
                msg: t
            });
            break;
        case "confirm":
            return parent.$.messager.confirm("确认", t, i)
    }
    return i && i(),
    null
},
com.messageif = function (n, t, i, r) {
    n && com.message(t, i, r)
},
com.openTab = parent.addTab,
com.setLocationHashId = function (n) {
    var t = parent.location.hash.split("/");
    t[t.length - 1] = n,
    parent.location.hash = t.join("/")
},
com.ajax = function (n) {
    n = $.extend({
        showLoading: !0
    }, n);
    var t = {
        type: "POST",
        dataType: "json",
        contentType: "application/json",
        error: function (n) {
            var t = n.responseText,
                i = t.match(/^{\"Message\":\"(.*)\",\"ExceptionMessage\":\"(.*)\",\"ExceptionType\":.*/);
            if (i != null) t = (i[1] + i[2]).replace(/\\"/g, '"').replace(/\\r\\n/g, "<br/>").replace(/dbo\./g, "");
            else try {
                t = $(t).text() || t
            } catch (r) { }
            com.message("error", t)
        }
    };
    n.showLoading && (t.beforeSend = $.showLoading, t.complete = $.hideLoading),
    $.ajax($.extend(t, n))
},
com.query = function (n) {
    var t = $;
    return $(document).find(n).length == 0 && n != document && $(parent.document).find(n) && (t = parent.$),
    t
},
com.formValidate = function (n) {
    var i, t, r;
    return (n = n || document, i = com.query(n), i.fn.validatebox && (t = i(".validatebox-text", n), t.length)) ? (t.validatebox("validate"), t.trigger("focus"), t.trigger("blur"), r = $(".validatebox-invalid:first", n).focus(), r.length == 0) : !0
},
com.formChanges = function (n, t, i) {
    var r, u, f;
    n = ko.toJS(n) || {},
    t = ko.toJS(t) || {},
    i = i || [],
    r = utils.diffrence(n, t, i, ["__ko_mapping__"]),
    u = 0;
    for (f in r) u++;
    return r._changed = u > i.length,
    r
},
com.editGridViewModel = function (n) {
    var t = this;
    this.begin = function (i, r) {
        (i == undefined || typeof i == "object") && (r = n.datagrid("getSelected"), i = n.datagrid("getRowIndex", r)),
        t.editIndex = t.ended() ? i : t.editIndex,
        n.datagrid("selectRow", t.editIndex).datagrid("beginEdit", t.editIndex)
    },
    this.ended = function () {
        return t.editIndex == undefined ? !0 : n.datagrid("validateRow", t.editIndex) ? (n.datagrid("endEdit", t.editIndex), t.editIndex = undefined, !0) : (n.datagrid("selectRow", t.editIndex), !1)
    },
    this.addnew = function (i) {
        t.ended() && (Object.prototype.toString.call(i) != "[object Object]" && (i = {}), i = $.extend({
            _isnew: !0
        }, i), n.datagrid("appendRow", i), t.editIndex = n.datagrid("getRows").length - 1, n.datagrid("selectRow", t.editIndex), t.begin(t.editIndex, i))
    },
    this.deleterow = function () {
        var r = n.datagrid("getSelected"),
            i;
        r && (i = n.datagrid("getRowIndex", r), i == t.editIndex && (n.datagrid("cancelEdit", t.editIndex), t.editIndex = undefined), n.datagrid("deleteRow", i))
    },
    this.reject = function () {
        n.datagrid("rejectChanges")
    },
    this.accept = function () {
        var t, i;
        n.datagrid("acceptChanges"),
        t = n.datagrid("getRows");
        for (i in t) delete t[i]._isnew
    },
    this.getChanges = function (t, i) {
        t || (t = [], i = !0);
        var u = utils.filterProperties(n.datagrid("getChanges", "deleted"), t, i),
            f = utils.filterProperties(n.datagrid("getChanges", "updated"), t, i),
            e = utils.filterProperties(n.datagrid("getChanges", "inserted"), t, i),
            r = {
                deleted: u,
                inserted: utils.minusArray(e, u),
                updated: utils.minusArray(f, u)
            };
        return r._changed = r.deleted.length + r.updated.length + r.inserted.length > 0,
        r
    },
    this.isChangedAndValid = function () {
        return t.ended() && t.getChanges()._changed
    }
},
com.editTreeGridViewModel = function (n) {
    var t = this,
        i = n.idField;
    this.begin = function (r) {
        var r = r || n.treegrid("getSelected");
        r && (t.editIndex = t.ended() ? r[i] : t.editIndex, n.treegrid("beginEdit", t.editIndex))
    },
    this.ended = function () {
        return t.editIndex == undefined ? !0 : n.treegrid("validateRow", t.editIndex) ? (n.treegrid("endEdit", t.editIndex), t.editIndex = undefined, !0) : (n.treegrid("select", t.editIndex), !1)
    },
    this.addnew = function (r, u) {
        t.ended() && (Object.prototype.toString.call(r) != "[object Object]" && (r = {}), r = $.extend({
            _isnew: !0
        }, r), u = u || "", r[i] || (r[i] = utils.uuid()), n.treegrid("append", {
            parent: u,
            data: [r]
        }), n.$element().data("datagrid").insertedRows.push(r), n.treegrid("select", r[i]), t.begin(r))
    },
    this.deleterow = function () {
        var r = n.treegrid("getSelected");
        r && (r[i] == t.editIndex && (n.treegrid("cancelEdit", t.editIndex), t.editIndex = undefined), n.treegrid("remove", r[i]), n.$element().data("datagrid").deletedRows.push(r))
    },
    this.reject = function () {
        throw "未实现此方法！";
    },
    this.accept = function () {
        var t, i;
        n.treegrid("acceptChanges"),
            t = n.$element().datagrid("getRows");
        for (i in t) delete t[i]._isnew
    },
    this.getChanges = function (t, i) {
        t || (t = [], i = !0);
        var u = utils.filterProperties(n.$element().datagrid("getChanges", "deleted"), t, i),
                f = utils.filterProperties(n.$element().datagrid("getChanges", "updated"), t, i),
                e = utils.filterProperties(n.$element().datagrid("getChanges", "inserted"), t, i),
                r = {
                    deleted: u,
                    inserted: utils.minusArray(e, u),
                    updated: utils.minusArray(f, u)
                };
        return r._changed = r.deleted.length + r.updated.length + r.inserted.length > 0,
            r
    },
    this.isChangedAndValid = function () {
        return t.ended() && t.getChanges()._changed
    }
},
com.dialog = function (n) {
    var t = parent.$,
        r = n.onClose,
        i;
    return n = t.extend({
        title: "My Dialog",
        width: 400,
        height: 220,
        closed: !1,
        cache: !1,
        modal: !0,
        html: "",
        url: "",
        viewModel: t.noop
    }, n),
    n.onClose = function () {
        t.isFunction(r) && r(),
            t(this).dialog("destroy")
    },
    t.isFunction(n.html) ? n.html = utils.functionComment(n.html) : /^\#.*\-template$/.test(n.html) && (n.html = $(n.html).html()),
    i = t("<div><\/div>").appendTo("body").html(n.html),
    n.url && t.ajax({
        async: !1,
        url: n.url,
        success: function (n) {
            i.empty().html(n)
        }
    }),
    i.dialog(n),
    t.parser.onComplete = function () {
        "undefined" == typeof ko ? n.viewModel(i) : ko.applyBindings(new n.viewModel(i), i[0]),
            t.parser.onComplete = t.noop
    },
    t.parser.parse(i),
    i
},
com.auditDialog = function () {
    var u = parent.$,
        t = u("#w_audit_div"),
        f = arguments,
        n, i, e, r;
    t.length == 0 && (n = '<div id="w_audit_wrapper">', n += '    <div id="w_audit_div" class="easyui-dialog"  title="审核" data-options="modal:true,closed:true,iconCls:\'icon-user-accept\'" style="width:400px;height:210px;" buttons="#w_audit_div_button">', n += '        <div class="container_16" style="width:90%;margin:5%;">                                                                                  ', n += '            <div class="grid_3 lbl" style="font-weight: bold;color:#7e7789">审核状态<\/div>                                                       ', n += '            <div class="grid_13 val">                                                                                                            ', n += '                通过<input type="radio" name="AuditStatus" value="passed" data-bind="checked:form.status" style="margin-right:10px;" />          ', n += '                不通过<input type="radio" name="AuditStatus" value="reject" data-bind="checked:form.status" />                                   ', n += "            <\/div>                                                                                                                               ", n += '            <div class="grid_3 lbl" style="margin-top:5px;font-weight: bold;color:#7e7789" style="font-weight: bold;">审核意见<\/div>             ', n += '            <div class="grid_13 val"><textarea style="width:272px;height:60px;" class="z-text" data-bind="value:form.comment" ><\/textarea><\/div> ', n += '            <div class="clear"><\/div>                                                                                                            ', n += "        <\/div>                                                                                                                                   ", n += "    <\/div>                                                                                                                                       ", n += '    <div id="w_audit_div_button" class="audit_button">                                                                                           ', n += '        <a href="javascript:void(0)" data-bind="click:confirmClick" class="easyui-linkbutton" iconCls="icon-ok" >确定<\/a>                        ', n += '        <a href="javascript:void(0)" data-bind="click:cancelClick" class="easyui-linkbutton" iconCls="icon-cancel" >取消<\/a>                     ', n += "    <\/div>                                                                                                                                       ", n += "<\/div>", i = u(n).appendTo("body"), i.find(".easyui-linkbutton").linkbutton(), t = i.find(".easyui-dialog").dialog()),
    e = function () {
        var n = this;
        this.form = {
            status: ko.observable("passed"),
            comment: ko.observable("")
        },
            this.confirmClick = function () {
                t.dialog("close"),
                typeof f[0] == "function" && f[0].call(this, ko.toJS(n.form))
            },
            this.cancelClick = function () {
                t.dialog("close")
            }
    },
    r = t.parent()[0],
    t.dialog("open"),
    ko.cleanNode(r),
    ko.applyBindings(new e, r)
},
com.readOnlyHandler = function (n) {
    return _readOnlyHandles = {},
    _readOnlyHandles.defaults = _readOnlyHandles.input = function (n, t) {
        t ? n.addClass("readonly").attr("readonly", !0) : n.removeClass("readonly").removeAttr("readonly")
    },
    _readOnlyHandles.combo = function (n, t) {
        var i = n.data("combo").combo;
        _readOnlyHandles.defaults(i.find(".combo-text"), t),
        t && (i.unbind(".combo"), i.find(".combo-arrow,.combo-text").unbind(".combo"), n.data("combo").panel.unbind(".combo"))
    },
    _readOnlyHandles.spinner = function (n, t) {
        _readOnlyHandles.defaults(n, t),
        t && n.data("spinner").spinner.find(".spinner-arrow-up,.spinner-arrow-down").unbind(".spinner")
    },
    _readOnlyHandles[n || "defaults"]
},
com.loadCss = function (n, t, i) {
    for (var f = t.getElementsByTagName("link"), e, u, r = 0; r < f.length; r++) if (f[r].href.indexOf(n) > -1) if (i) f[r].parentNode.removeChild(f[r]);
    else return;
    e = t.getElementsByTagName("head")[0],
    u = t.createElement("link"),
    u.rel = "stylesheet",
    u.type = "text/css",
    u.media = "screen",
    u.href = n,
    e.appendChild(u)
},
com.exporter = function (n) {
    var t = this,
        i = {
            action: "/home/download",
            dataGetter: "api",
            dataAction: "",
            dataParams: {},
            titles: [
                []
            ],
            fileType: "xls",
            compressType: "none"
        };
    return this.paging = function (n, i) {
        return t.params.dataParams.page = n,
            t.params.dataParams.rows = i,
            t
    },
    this.compress = function () {
        return t.params.compressType = "zip",
            t
    },
    this.title = function (n, i) {
        return t.params.titles[n] = i,
            t
    },
    this.download = function (n) {
        var f, i, r, u;
        if (t.params.fileType = n || "xls", t.params.dataParams = JSON.stringify(t.params.dataParams), t.params.titles = JSON.stringify(t.params.titles), f = $('<iframe style="display:none;" id="downloadHelper"><\/iframe>').appendTo("body")[0], i = f.contentWindow.document, i) {
            i.open(),
                i.write(""),
                i.writeln(utils.formatString("<html><body><form id='downloadForm' name='downloadForm' method='post' action='{0}'>", t.params.action));
            for (r in t.params) i.writeln(utils.formatString("<input type='hidden' name='{0}' value='{1}'>", r, t.params[r]));
            i.writeln("<\/form><\/body><\/html>"),
                i.close(),
                u = i.forms[0],
                u && u.submit()
        }
    },
    initFromGrid = function (n) {
        var r = n.$element().datagrid("options"),
                f, e, u;
        for (n.treegrid && (r.url = r.url || n.treegrid("options").url), f = [
                    []
                ], e = Math.max(r.frozenColumns.length, r.columns.length), u = 0; u < e; u++) f[u] = (r.frozenColumns[u] || []).concat(r.columns[u] || []);
        t.params = $.extend(!0, {}, i, {
            dataAction: r.url,
            dataParams: r.queryParams,
            titles: f
        })
    },
    n.$element ? initFromGrid(n) : t.params = $.extend(!0, {}, i, n),
    t
},
com.setVarible = function (n, t) {
    parent.$(parent.document.body).data(n, t)
},
com.getVarible = function (n) {
    return parent.$(parent.document.body).data(n)
},
com.cookie = $.cookie,


function () {
    function u(n) {
        throw n;
    }
    function s(n) {
        return function () {
            return n
        }
    }
    function h(h) {
        function gt(n, i, u, f, e) {
            var o = [];
            return n = l.j(function () {
                var n = i(u, e) || [];
                0 < o.length && (l.a.Ya(k(o), n), f && l.r.K(f, t, [u, n, e])),
                o.splice(0, o.length),
                l.a.P(o, n)
            }, t, {
                W: n,
                Ka: function () {
                    return 0 == o.length || !l.a.X(o[0])
                }
            }),
            {
                M: o,
                j: n.pa() ? n : r
            }
        }
        function k(n) {
            for (; n.length && !l.a.X(n[0]); ) n.splice(0, 1);
            if (1 < n.length) {
                for (var t = n[0], r = n[n.length - 1], i = [t]; t !== r; ) {
                    if (t = t.nextSibling, !t) return;
                    i.push(t)
                }
                Array.prototype.splice.apply(n, [0, n.length].concat(i))
            }
            return n
        }
        function ut(n, t, i, r, u) {
            for (var o = Math.min, l = Math.max, s = [], a = n.length, f, h = t.length, c = h - a || 1, w = a + h + 1, v, p, b, y, e = 0; e <= a; e++) for (p = v, s.push(v = []), b = o(h, e + c), f = l(0, e - 1); f <= b; f++) v[f] = f ? e ? n[e - 1] === t[f - 1] ? p[f - 1] : o(p[f] || w, v[f - 1] || w) + 1 : f + 1 : e + 1;
            for (o = [], l = [], c = [], e = a, f = h; e || f; ) h = s[e][f] - 1,
            f && h === s[e][f - 1] ? l.push(o[o.length] = {
                status: i,
                value: t[--f],
                index: f
            }) : e && h === s[e - 1][f] ? c.push(o[o.length] = {
                status: r,
                value: n[--e],
                index: e
            }) : (o.push({
                status: "retained",
                value: t[--f]
            }), --e);
            if (l.length && c.length) for (n = 10 * a, t = i = 0;
            (u || t < n) && (y = l[i]); i++) {
                for (r = 0; s = c[r]; r++) if (y.value === s.value) {
                    y.moved = s.index,
                    s.moved = y.index,
                    c.splice(r, 1),
                    t = r = 0;
                    break
                }
                t += r
            }
            return o.reverse()
        }
        function ft(r, f, e, o, s) {
            s = s || {};
            var h = r && d(r),
                h = h && h.ownerDocument,
                c = s.templateEngine || rt;
            l.za.vb(e, c, h),
            e = c.renderTemplate(e, o, s, h),
            ("number" != typeof e.length || 0 < e.length && "number" != typeof e[0].nodeType) && u(Error("Template engine must return an array of DOM nodes")),
            h = i;
            switch (f) {
                case "replaceChildren":
                    l.e.N(r, e),
                    h = n;
                    break;
                case "replaceNode":
                    l.a.Ya(r, e),
                    h = n;
                    break;
                case "ignoreTargetNode":
                    break;
                default:
                    u(Error("Unknown renderMode: " + f))
            }
            return h && (et(e, o), s.afterRender && l.r.K(s.afterRender, t, [e, o.$data])),
            e
        }
        function d(n) {
            return n.nodeType ? n : 0 < n.length ? n[0] : t
        }
        function et(n, t) {
            if (n.length) {
                var i = n[0],
                    r = n[n.length - 1];
                ot(i, r, function (n) {
                    l.Da(t, n)
                }),
                ot(i, r, function (n) {
                    l.s.ib(n, [t])
                })
            }
        }
        function ot(n, t, i) {
            var r;
            for (t = l.e.nextSibling(t); n && (r = n) !== t; ) n = l.e.nextSibling(r),
            (1 === r.nodeType || 8 === r.nodeType) && i(r)
        }
        function st(n, t, i) {
            var o, f, r, e;
            for (n = l.g.aa(n), o = l.g.Q, f = 0; f < n.length; f++) r = n[f].key,
            o.hasOwnProperty(r) && (e = o[r], "function" == typeof e ? (r = e(n[f].value)) && u(Error(r)) : e || u(Error("This template engine does not support the '" + r + "' binding within its templates")));
            return n = "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + l.g.ba(n) + " } })()})",
            i.createJavaScriptEvaluatorBlock(n) + t
        }
        function ht(n, i, f, e) {
            function c(n) {
                return function () {
                    return o[n]
                }
            }
            function a() {
                return o
            }
            var s = 0,
                o, h;
            return l.j(function () {
                var y = f && f instanceof l.z ? f : new l.z(l.a.d(f)),
                        p = y.$data,
                        t, v;
                if (e && l.eb(n, y), o = ("function" == typeof i ? i(y, n) : i) || l.J.instance.getBindings(n, y)) {
                    if (0 === s) {
                        s = 1;
                        for (t in o) v = l.c[t],
                                v && 8 === n.nodeType && !l.e.I[t] && u(Error("The binding '" + t + "' cannot be used with virtual elements")),
                                v && "function" == typeof v.init && (v = v.init(n, c(t), a, p, y)) && v.controlsDescendantBindings && (h !== r && u(Error("Multiple bindings (" + h + " and " + t + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.")), h = t);
                        s = 2
                    }
                    if (2 === s) for (t in o) (v = l.c[t]) && "function" == typeof v.update && v.update(n, c(t), a, p, y)
                }
            }, t, {
                W: n
            }),
            {
                Nb: h === r
            }
        }
        function ct(i, r, u) {
            var e = n,
                f = 1 === r.nodeType;
            f && l.e.Ta(r),
            (f && u || l.J.instance.nodeHasBindings(r)) && (e = ht(r, t, i, u).Nb),
            e && lt(i, r, !f)
        }
        function lt(n, t, i) {
            for (var r = l.e.firstChild(t); t = r; ) r = l.e.nextSibling(t),
            ct(n, t, i)
        }
        function at(n, i) {
            var r = vt(n, i);
            return r ? 0 < r.length ? r[r.length - 1].nextSibling : n.nextSibling : t
        }
        function vt(n, i) {
            for (var r = n, f = 1, e = []; r = r.nextSibling; ) {
                if (p(r) && (f--, 0 === f)) return e;
                e.push(r),
                a(r) && f++
            }
            return i || u(Error("Cannot find closing comment tag to match: " + n.nodeValue)),
            t
        }
        function p(n) {
            return 8 == n.nodeType && (b ? n.text : n.nodeValue).match(fi)
        }
        function a(n) {
            return 8 == n.nodeType && (b ? n.text : n.nodeValue).match(ui)
        }
        function g(n, i) {
            for (var r = t; n != r; ) r = n,
            n = n.replace(ti, function (n, t) {
                return i[t]
            });
            return n
        }
        function ni() {
            var n = [],
                t = [];
            this.save = function (i, r) {
                var u = l.a.i(n, i);
                0 <= u ? t[u] = r : (n.push(i), t.push(r))
            },
            this.get = function (i) {
                return i = l.a.i(n, i),
                    0 <= i ? t[i] : r
            }
        }
        function yt(n, i, u) {
            function s(t) {
                var f = i(n[t]),
                    o;
                switch (typeof f) {
                    case "boolean":
                    case "number":
                    case "string":
                    case "function":
                        e[t] = f;
                        break;
                    case "object":
                    case "undefined":
                        o = u.get(f),
                        e[t] = o !== r ? o : yt(f, i, u)
                }
            }
            var e, o, f;
            if (u = u || new ni, n = i(n), !("object" == typeof n && n !== t && n !== r && !(n instanceof Date))) return n;
            if (e = n instanceof Array ? [] : {}, u.save(n, e), o = n, o instanceof Array) {
                for (f = 0; f < o.length; f++) s(f);
                "function" == typeof o.toJSON && s("toJSON")
            } else for (f in o) s(f);
            return e
        }
        function pt(n, i) {
            var r;
            if (n) if (8 == n.nodeType) r = l.s.Ua(n.nodeValue),
            r != t && i.push({
                sb: n,
                Fb: r
            });
            else if (1 == n.nodeType) for (var r = 0, u = n.childNodes, f = u.length; r < f; r++) pt(u[r], i)
        }
        function nt(t, r, u, f) {
            l.c[t] = {
                init: function (t) {
                    return l.a.f.set(t, it, {}),
                    {
                        controlsDescendantBindings: n
                    }
                },
                update: function (t, i, e, o, s) {
                    e = l.a.f.get(t, it),
                    i = l.a.d(i()),
                    o = !u != !i;
                    var h = !e.Za;
                    (h || r || o !== e.qb) && (h && (e.Za = l.a.Ia(l.e.childNodes(t), n)), o ? (h || l.e.N(t, l.a.Ia(e.Za)), l.Ea(f ? f(s, i) : s, t)) : l.e.Y(t), e.qb = o)
                }
            },
            l.g.Q[t] = i,
            l.e.I[t] = n
        }
        function wt(n, i, r) {
            r && i !== l.k.q(n) && l.k.T(n, i),
            i !== l.k.q(n) && l.r.K(l.a.Ba, t, [n, "change"])
        }
        var l = "undefined" != typeof h ? h : {},
            w, v, bt, y, tt, it, kt, dt, rt;
        l.b = function (n, t) {
            for (var i = n.split("."), r = l, u = 0; u < i.length - 1; u++) r = r[i[u]];
            r[i[i.length - 1]] = t
        },
        l.p = function (n, t, i) {
            n[t] = i
        },
        l.version = "2.2.1",
        l.b("version", l.version),
        l.a = new 
        function () {
            function p(n, t) {
                if ("input" !== l.a.u(n) || !n.type || "click" != t.toLowerCase()) return i;
                var r = n.type;
                return "checkbox" == r || "radio" == r
            }
            var d = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
                    h = {},
                    w = {},
                    a, v, y, b, k, s;
            h[/Firefox\/2/i.test(c.userAgent) ? "KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"],
                h.MouseEvents = "click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");
            for (a in h) if (v = h[a], v.length) for (y = 0, b = v.length; y < b; y++) w[v[y]] = a;
            for (k = {
                propertychange: n
            }, h = 3, a = e.createElement("div"), v = a.getElementsByTagName("i"); a.innerHTML = "<!--[if gt IE " + ++h + "]><i><\/i><![endif]-->", v[0]; );
            return s = 4 < h ? h : r,
                {
                    Na: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/],
                    o: function (n, t) {
                        for (var i = 0, r = n.length; i < r; i++) t(n[i])
                    },
                    i: function (n, t) {
                        if ("function" == typeof Array.prototype.indexOf) return Array.prototype.indexOf.call(n, t);
                        for (var i = 0, r = n.length; i < r; i++) if (n[i] === t) return i;
                        return -1
                    },
                    lb: function (n, i, r) {
                        for (var u = 0, f = n.length; u < f; u++) if (i.call(r, n[u])) return n[u];
                        return t
                    },
                    ga: function (n, t) {
                        var i = l.a.i(n, t);
                        0 <= i && n.splice(i, 1)
                    },
                    Ga: function (n) {
                        n = n || [];
                        for (var i = [], t = 0, r = n.length; t < r; t++) 0 > l.a.i(i, n[t]) && i.push(n[t]);
                        return i
                    },
                    V: function (n, t) {
                        n = n || [];
                        for (var r = [], i = 0, u = n.length; i < u; i++) r.push(t(n[i]));
                        return r
                    },
                    fa: function (n, t) {
                        n = n || [];
                        for (var r = [], i = 0, u = n.length; i < u; i++) t(n[i]) && r.push(n[i]);
                        return r
                    },
                    P: function (n, t) {
                        if (t instanceof Array) n.push.apply(n, t);
                        else for (var i = 0, r = t.length; i < r; i++) n.push(t[i]);
                        return n
                    },
                    extend: function (n, t) {
                        if (t) for (var i in t) t.hasOwnProperty(i) && (n[i] = t[i]);
                        return n
                    },
                    ka: function (n) {
                        for (; n.firstChild; ) l.removeNode(n.firstChild)
                    },
                    Hb: function (n) {
                        n = l.a.L(n);
                        for (var i = e.createElement("div"), t = 0, r = n.length; t < r; t++) i.appendChild(l.A(n[t]));
                        return i
                    },
                    Ia: function (t, i) {
                        for (var u, r = 0, e = t.length, f = []; r < e; r++) u = t[r].cloneNode(n),
                            f.push(i ? l.A(u) : u);
                        return f
                    },
                    N: function (n, t) {
                        if (l.a.ka(n), t) for (var i = 0, r = t.length; i < r; i++) n.appendChild(t[i])
                    },
                    Ya: function (n, t) {
                        var r = n.nodeType ? [n] : n;
                        if (0 < r.length) {
                            for (var f = r[0], e = f.parentNode, i = 0, u = t.length; i < u; i++) e.insertBefore(t[i], f);
                            for (i = 0, u = r.length; i < u; i++) l.removeNode(r[i])
                        }
                    },
                    bb: function (n, t) {
                        7 > s ? n.setAttribute("selected", t) : n.selected = t
                    },
                    D: function (n) {
                        return (n || "").replace(d, "")
                    },
                    Rb: function (n, t) {
                        for (var r, u = [], f = (n || "").split(t), i = 0, e = f.length; i < e; i++) r = l.a.D(f[i]),
                            "" !== r && u.push(r);
                        return u
                    },
                    Ob: function (n, t) {
                        return n = n || "",
                            t.length > n.length ? i : n.substring(0, t.length) === t
                    },
                    tb: function (r, u) {
                        if (u.compareDocumentPosition) return 16 == (u.compareDocumentPosition(r) & 16);
                        for (; r != t; ) {
                            if (r == u) return n;
                            r = r.parentNode
                        }
                        return i
                    },
                    X: function (n) {
                        return l.a.tb(n, n.ownerDocument)
                    },
                    u: function (n) {
                        return n && n.tagName && n.tagName.toLowerCase()
                    },
                    n: function (t, r, e) {
                        var o = s && k[r],
                                h;
                        o || "undefined" == typeof f ? !o && "function" == typeof t.addEventListener ? t.addEventListener(r, e, i) : "undefined" != typeof t.attachEvent ? t.attachEvent("on" + r, function (n) {
                            e.call(t, n)
                        }) : u(Error("Browser doesn't support addEventListener or attachEvent")) : (p(t, r) && (h = e, e = function (t, i) {
                            var r = this.checked;
                            i && (this.checked = i.nb !== n),
                                    h.call(this, t),
                                    this.checked = r
                        }), f(t).bind(r, e))
                    },
                    Ba: function (t, r) {
                        if (t && t.nodeType || u(Error("element must be a DOM node when calling triggerEvent")), "undefined" != typeof f) {
                            var s = [];
                            p(t, r) && s.push({
                                nb: t.checked
                            }),
                                f(t).trigger(r, s)
                        } else "function" == typeof e.createEvent ? "function" == typeof t.dispatchEvent ? (s = e.createEvent(w[r] || "HTMLEvents"), s.initEvent(r, n, n, o, 0, 0, 0, 0, 0, i, i, i, i, 0, t), t.dispatchEvent(s)) : u(Error("The supplied element doesn't support dispatchEvent")) : "undefined" != typeof t.fireEvent ? (p(t, r) && (t.checked = t.checked !== n), t.fireEvent("on" + r)) : u(Error("Browser doesn't support triggering events"))
                    },
                    d: function (n) {
                        return l.$(n) ? n() : n
                    },
                    ua: function (n) {
                        return l.$(n) ? n.t() : n
                    },
                    da: function (n, t, i) {
                        if (t) {
                            var u = /[\w-]+/g,
                                    r = n.className.match(u) || [];
                            l.a.o(t.match(u), function (n) {
                                var t = l.a.i(r, n);
                                0 <= t ? i || r.splice(t, 1) : i && r.push(n)
                            }),
                                n.className = r.join(" ")
                        }
                    },
                    cb: function (n, i) {
                        var u = l.a.d(i),
                                f;
                        (u === t || u === r) && (u = ""),
                            3 === n.nodeType ? n.data = u : (f = l.e.firstChild(n), !f || 3 != f.nodeType || l.e.nextSibling(f) ? l.e.N(n, [e.createTextNode(u)]) : f.data = u, l.a.wb(n))
                    },
                    ab: function (n, t) {
                        if (n.name = t, 7 >= s) try {
                            n.mergeAttributes(e.createElement("<input name='" + n.name + "'/>"), i)
                        } catch (r) { }
                    },
                    wb: function (n) {
                        9 <= s && (n = 1 == n.nodeType ? n : n.parentNode, n.style && (n.style.zoom = n.style.zoom))
                    },
                    ub: function (n) {
                        if (9 <= s) {
                            var t = n.style.width;
                            n.style.width = 0,
                                n.style.width = t
                        }
                    },
                    Lb: function (n, t) {
                        n = l.a.d(n),
                            t = l.a.d(t);
                        for (var r = [], i = n; i <= t; i++) r.push(i);
                        return r
                    },
                    L: function (n) {
                        for (var i = [], t = 0, r = n.length; t < r; t++) i.push(n[t]);
                        return i
                    },
                    Pb: 6 === s,
                    Qb: 7 === s,
                    Z: s,
                    Oa: function (n, t) {
                        for (var r = l.a.L(n.getElementsByTagName("input")).concat(l.a.L(n.getElementsByTagName("textarea"))), f = "string" == typeof t ?
                            function (n) {
                                return n.name === t
                            } : function (n) {
                                return t.test(n.name)
                            }, u = [], i = r.length - 1; 0 <= i; i--) f(r[i]) && u.push(r[i]);
                        return u
                    },
                    Ib: function (n) {
                        return "string" == typeof n && (n = l.a.D(n)) ? o.JSON && o.JSON.parse ? o.JSON.parse(n) : new Function("return " + n)() : t
                    },
                    xa: function (n, t, i) {
                        return ("undefined" == typeof JSON || "undefined" == typeof JSON.stringify) && u(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js")),
                            JSON.stringify(l.a.d(n), t, i)
                    },
                    Jb: function (n, t, i) {
                        var a, o, s, f, r, u;
                        i = i || {};
                        var h = i.params || {},
                                c = i.includeFields || this.Na,
                                a = n;
                        if ("object" == typeof n && "form" === l.a.u(n)) for (a = n.action, o = c.length - 1; 0 <= o; o--) for (s = l.a.Oa(n, c[o]), f = s.length - 1; 0 <= f; f--) h[s[f].name] = s[f].value;
                        t = l.a.d(t),
                            r = e.createElement("form"),
                            r.style.display = "none",
                            r.action = a,
                            r.method = "post";
                        for (u in t) n = e.createElement("input"),
                            n.name = u,
                            n.value = l.a.xa(l.a.d(t[u])),
                            r.appendChild(n);
                        for (u in h) n = e.createElement("input"),
                            n.name = u,
                            n.value = h[u],
                            r.appendChild(n);
                        e.body.appendChild(r),
                            i.submitter ? i.submitter(r) : r.submit(),
                            setTimeout(function () {
                                r.parentNode.removeChild(r)
                            }, 0)
                    }
                }
        },
        l.b("utils", l.a),
        l.b("utils.arrayForEach", l.a.o),
        l.b("utils.arrayFirst", l.a.lb),
        l.b("utils.arrayFilter", l.a.fa),
        l.b("utils.arrayGetDistinctValues", l.a.Ga),
        l.b("utils.arrayIndexOf", l.a.i),
        l.b("utils.arrayMap", l.a.V),
        l.b("utils.arrayPushAll", l.a.P),
        l.b("utils.arrayRemoveItem", l.a.ga),
        l.b("utils.extend", l.a.extend),
        l.b("utils.fieldsIncludedWithJsonPost", l.a.Na),
        l.b("utils.getFormFields", l.a.Oa),
        l.b("utils.peekObservable", l.a.ua),
        l.b("utils.postJson", l.a.Jb),
        l.b("utils.parseJson", l.a.Ib),
        l.b("utils.registerEventHandler", l.a.n),
        l.b("utils.stringifyJson", l.a.xa),
        l.b("utils.range", l.a.Lb),
        l.b("utils.toggleDomNodeCssClass", l.a.da),
        l.b("utils.triggerEvent", l.a.Ba),
        l.b("utils.unwrapObservable", l.a.d),
        Function.prototype.bind || (Function.prototype.bind = function (n) {
            var i = this,
                    t = Array.prototype.slice.call(arguments);
            return n = t.shift(),


                function () {
                    return i.apply(n, t.concat(Array.prototype.slice.call(arguments)))
                }
        }),
        l.a.f = new 
        function () {
            var e = 0,
                    u = "__ko__" + +new Date,
                    f = {};
            return {
                get: function (n, t) {
                    var u = l.a.f.la(n, i);
                    return u === r ? r : u[t]
                },
                set: function (t, u, f) {
                    f === r && l.a.f.la(t, i) === r || (l.a.f.la(t, n)[u] = f)
                },
                la: function (n, t) {
                    var i = n[u];
                    if (!i || !("null" !== i && f[i])) {
                        if (!t) return r;
                        i = n[u] = "ko" + e++,
                                f[i] = {}
                    }
                    return f[i]
                },
                clear: function (r) {
                    var e = r[u];
                    return e ? (delete f[e], r[u] = t, n) : i
                }
            }
        },
        l.b("utils.domData", l.a.f),
        l.b("utils.domData.clear", l.a.f.clear),
        l.a.F = new 
        function () {
            function t(n, t) {
                var i = l.a.f.get(n, o);
                return i === r && t && (i = [], l.a.f.set(n, o, i)),
                    i
            }
            function e(n) {
                var r = t(n, i),
                        u;
                if (r) for (r = r.slice(0), u = 0; u < r.length; u++) r[u](n);
                if (l.a.f.clear(n), "function" == typeof f && "function" == typeof f.cleanData && f.cleanData([n]), s[n.nodeType]) for (r = n.firstChild; n = r; ) r = n.nextSibling,
                    8 === n.nodeType && e(n)
            }
            var o = "__ko_domNodeDisposal__" + +new Date,
                    h = {
                        1: n,
                        8: n,
                        9: n
                    },
                    s = {
                        1: n,
                        9: n
                    };
            return {
                Ca: function (i, r) {
                    "function" != typeof r && u(Error("Callback must be a function")),
                            t(i, n).push(r)
                },
                Xa: function (n, u) {
                    var f = t(n, i);
                    f && (l.a.ga(f, u), 0 == f.length && l.a.f.set(n, o, r))
                },
                A: function (n) {
                    var t, i, r;
                    if (h[n.nodeType] && (e(n), s[n.nodeType])) for (t = [], l.a.P(t, n.getElementsByTagName("*")), i = 0, r = t.length; i < r; i++) e(t[i]);
                    return n
                },
                removeNode: function (n) {
                    l.A(n),
                            n.parentNode && n.parentNode.removeChild(n)
                }
            }
        },
        l.A = l.a.F.A,
        l.removeNode = l.a.F.removeNode,
        l.b("cleanNode", l.A),
        l.b("removeNode", l.removeNode),
        l.b("utils.domNodeDisposal", l.a.F),
        l.b("utils.domNodeDisposal.addDisposeCallback", l.a.F.Ca),
        l.b("utils.domNodeDisposal.removeDisposeCallback", l.a.F.Xa),
        l.a.ta = function (n) {
            var t, i;
            if ("undefined" != typeof f) {
                if (f.parseHTML) t = f.parseHTML(n);
                else if ((t = f.clean([n])) && t[0]) {
                    for (n = t[0]; n.parentNode && 11 !== n.parentNode.nodeType; ) n = n.parentNode;
                    n.parentNode && n.parentNode.removeChild(n)
                }
            } else {
                for (i = l.a.D(n).toLowerCase(), t = e.createElement("div"), i = i.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "<\/table>"] || !i.indexOf("<tr") && [2, "<table><tbody>", "<\/tbody><\/table>"] || (!i.indexOf("<td") || !i.indexOf("<th")) && [3, "<table><tbody><tr>", "<\/tr><\/tbody><\/table>"] || [0, "", ""], n = "ignored<div>" + i[1] + n + i[2] + "<\/div>", "function" == typeof o.innerShiv ? t.appendChild(o.innerShiv(n)) : t.innerHTML = n; i[0]--; ) t = t.lastChild;
                t = l.a.L(t.lastChild.childNodes)
            }
            return t
        },
        l.a.ca = function (n, i) {
            if (l.a.ka(n), i = l.a.d(i), i !== t && i !== r) if ("string" != typeof i && (i = i.toString()), "undefined" != typeof f) f(n).html(i);
            else for (var e = l.a.ta(i), u = 0; u < e.length; u++) n.appendChild(e[u])
        },
        l.b("utils.parseHtmlFragment", l.a.ta),
        l.b("utils.setHtml", l.a.ca),
        w = {},
        l.s = {
            ra: function (n) {
                "function" != typeof n && u(Error("You can only pass a function to ko.memoization.memoize()"));
                var t = (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1) + (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1);
                return w[t] = n,
                    "<!--[ko_memo:" + t + "]-->"
            },
            hb: function (i, f) {
                var e = w[i];
                e === r && u(Error("Couldn't find any memo with ID " + i + ". Perhaps it's already been unmemoized."));
                try {
                    return e.apply(t, f || []),
                        n
                } finally {
                    delete w[i]
                }
            },
            ib: function (n, t) {
                var u = [],
                        r, e, i, f;
                for (pt(n, u), r = 0, e = u.length; r < e; r++) i = u[r].sb,
                    f = [i],
                    t && l.a.P(f, t),
                    l.s.hb(u[r].Fb, f),
                    i.nodeValue = "",
                    i.parentNode && i.parentNode.removeChild(i)
            },
            Ua: function (n) {
                return (n = n.match(/^\[ko_memo\:(.*?)\]$/)) ? n[1] : t
            }
        },
        l.b("memoization", l.s),
        l.b("memoization.memoize", l.s.ra),
        l.b("memoization.unmemoize", l.s.hb),
        l.b("memoization.parseMemoText", l.s.Ua),
        l.b("memoization.unmemoizeDomNodeAndDescendants", l.s.ib),
        l.Ma = {
            throttle: function (n, i) {
                n.throttleEvaluation = i;
                var r = t;
                return l.j({
                    read: n,
                    write: function (t) {
                        clearTimeout(r),
                            r = setTimeout(function () {
                                n(t)
                            }, i)
                    }
                })
            },
            notify: function (n, t) {
                return n.equalityComparer = "always" == t ? s(i) : l.m.fn.equalityComparer,
                    n
            }
        },
        l.b("extenders", l.Ma),
        l.fb = function (n, t, i) {
            this.target = n,
                this.ha = t,
                this.rb = i,
                l.p(this, "dispose", this.B)
        },
        l.fb.prototype.B = function () {
            this.Cb = n,
                this.rb()
        },
        l.S = function () {
            this.w = {},
                l.a.extend(this, l.S.fn),
                l.p(this, "subscribe", this.ya),
                l.p(this, "extend", this.extend),
                l.p(this, "getSubscriptionsCount", this.yb)
        },
        l.S.fn = {
            ya: function (n, t, i) {
                i = i || "change";
                var r = new l.fb(this, t ? n.bind(t) : n, function () {
                    l.a.ga(this.w[i], r)
                } .bind(this));
                return this.w[i] || (this.w[i] = []),
                    this.w[i].push(r),
                    r
            },
            notifySubscribers: function (t, i) {
                i = i || "change",
                    this.w[i] && l.r.K(function () {
                        l.a.o(this.w[i].slice(0), function (i) {
                            i && i.Cb !== n && i.ha(t)
                        })
                    }, this)
            },
            yb: function () {
                var t = 0,
                        n;
                for (n in this.w) this.w.hasOwnProperty(n) && (t += this.w[n].length);
                return t
            },
            extend: function (n) {
                var t = this,
                        i, r;
                if (n) for (i in n) r = l.Ma[i],
                    "function" == typeof r && (t = r(t, n[i]));
                return t
            }
        },
        l.Qa = function (n) {
            return "function" == typeof n.ya && "function" == typeof n.notifySubscribers
        },
        l.b("subscribable", l.S),
        l.b("isSubscribable", l.Qa),
        v = [],
        l.r = {
            mb: function (n) {
                v.push({
                    ha: n,
                    La: []
                })
            },
            end: function () {
                v.pop()
            },
            Wa: function (n) {
                if (l.Qa(n) || u(Error("Only subscribable things can act as dependencies")), 0 < v.length) {
                    var t = v[v.length - 1];
                    !t || 0 <= l.a.i(t.La, n) || (t.La.push(n), t.ha(n))
                }
            },
            K: function (n, i, r) {
                try {
                    return v.push(t),
                        n.apply(i, r || [])
                } finally {
                    v.pop()
                }
            }
        },
        bt = {
            undefined: n,
            boolean: n,
            number: n,
            string: n
        },
        l.m = function (n) {
            function t() {
                return 0 < arguments.length ? (t.equalityComparer && t.equalityComparer(i, arguments[0]) || (t.H(), i = arguments[0], t.G()), this) : (l.r.Wa(t), i)
            }
            var i = n;
            return l.S.call(t),
                t.t = function () {
                    return i
                },
                t.G = function () {
                    t.notifySubscribers(i)
                },
                t.H = function () {
                    t.notifySubscribers(i, "beforeChange")
                },
                l.a.extend(t, l.m.fn),
                l.p(t, "peek", t.t),
                l.p(t, "valueHasMutated", t.G),
                l.p(t, "valueWillMutate", t.H),
                t
        },
        l.m.fn = {
            equalityComparer: function (n, r) {
                return n === t || typeof n in bt ? n === r : i
            }
        },
        y = l.m.Kb = "__ko_proto__",
        l.m.fn[y] = l.m,
        l.ma = function (u, f) {
            return u === t || u === r || u[y] === r ? i : u[y] === f ? n : l.ma(u[y], f)
        },
        l.$ = function (n) {
            return l.ma(n, l.m)
        },
        l.Ra = function (t) {
            return "function" == typeof t && t[y] === l.m || "function" == typeof t && t[y] === l.j && t.zb ? n : i
        },
        l.b("observable", l.m),
        l.b("isObservable", l.$),
        l.b("isWriteableObservable", l.Ra),
        l.R = function (n) {
            0 == arguments.length && (n = []),
                n === t || n === r || "length" in n || u(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));
            var i = l.m(n);
            return l.a.extend(i, l.R.fn),
                i
        },
        l.R.fn = {
            remove: function (n) {
                for (var u, r = this.t(), i = [], f = "function" == typeof n ? n : function (t) {
                    return t === n
                }, t = 0; t < r.length; t++) u = r[t],
                    f(u) && (0 === i.length && this.H(), i.push(u), r.splice(t, 1), t--);
                return i.length && this.G(),
                    i
            },
            removeAll: function (n) {
                if (n === r) {
                    var t = this.t(),
                            i = t.slice(0);
                    return this.H(),
                        t.splice(0, t.length),
                        this.G(),
                        i
                }
                return n ? this.remove(function (t) {
                    return 0 <= l.a.i(n, t)
                }) : []
            },
            destroy: function (t) {
                var r = this.t(),
                        u = "function" == typeof t ? t : function (n) {
                            return n === t
                        },
                        i;
                for (this.H(), i = r.length - 1; 0 <= i; i--) u(r[i]) && (r[i]._destroy = n);
                this.G()
            },
            destroyAll: function (t) {
                return t === r ? this.destroy(s(n)) : t ? this.destroy(function (n) {
                    return 0 <= l.a.i(t, n)
                }) : []
            },
            indexOf: function (n) {
                var t = this();
                return l.a.i(t, n)
            },
            replace: function (n, t) {
                var i = this.indexOf(n);
                0 <= i && (this.H(), this.t()[i] = t, this.G())
            }
        },
        l.a.o("pop push reverse shift sort splice unshift".split(" "), function (n) {
            l.R.fn[n] = function () {
                var t = this.t();
                return this.H(),
                    t = t[n].apply(t, arguments),
                    this.G(),
                    t
            }
        }),
        l.a.o(["slice"], function (n) {
            l.R.fn[n] = function () {
                var t = this();
                return t[n].apply(t, arguments)
            }
        }),
        l.b("observableArray", l.R),
        l.j = function (f, e, o) {
            function g() {
                l.a.o(a, function (n) {
                    n.B()
                }),
                    a = []
            }
            function ut() {
                var n = h.throttleEvaluation;
                n && 0 <= n ? (clearTimeout(it), it = setTimeout(v, n)) : v()
            }
            function v() {
                var t, f, u;
                if (!k) if (p && d()) w();
                else {
                    k = n;
                    try {
                        for (t = l.a.V(a, function (n) {
                            return n.target
                        }), l.r.mb(function (n) {
                            var i;
                            0 <= (i = l.a.i(t, n)) ? t[i] = r : a.push(n.ya(ut))
                        }), f = c.call(e), u = t.length - 1; 0 <= u; u--) t[u] && a.splice(u, 1)[0].B();
                        p = n,
                            h.notifySubscribers(y, "beforeChange"),
                            y = f
                    } finally {
                        l.r.end()
                    }
                    h.notifySubscribers(y),
                        k = i,
                        a.length || w()
                }
            }
            function h() {
                return 0 < arguments.length ? ("function" == typeof tt ? tt.apply(e, arguments) : u(Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.")), this) : (p || v(), l.r.Wa(h), y)
            }
            function nt() {
                return !p || 0 < a.length
            }
            var y, p = i,
                    k = i,
                    c = f,
                    rt, d;
            c && "object" == typeof c ? (o = c, c = o.read) : (o = o || {}, c || (c = o.read)),
                "function" != typeof c && u(Error("Pass a function that returns the value of the ko.computed"));
            var tt = o.write,
                    b = o.disposeWhenNodeIsRemoved || o.W || t,
                    d = o.disposeWhen || o.Ka || s(i),
                    w = g,
                    a = [],
                    it = t;
            return e || (e = o.owner),
                h.t = function () {
                    return p || v(),
                        y
                },
                h.xb = function () {
                    return a.length
                },
                h.zb = "function" == typeof o.write,
                h.B = function () {
                    w()
                },
                h.pa = nt,
                l.S.call(h),
                l.a.extend(h, l.j.fn),
                l.p(h, "peek", h.t),
                l.p(h, "dispose", h.B),
                l.p(h, "isActive", h.pa),
                l.p(h, "getDependenciesCount", h.xb),
                o.deferEvaluation !== n && v(),
                b && nt() && (w = function () {
                    l.a.F.Xa(b, arguments.callee),
                        g()
                }, l.a.F.Ca(b, w), rt = d, d = function () {
                    return !l.a.X(b) || rt()
                }),
                h
        },
        l.Bb = function (n) {
            return l.ma(n, l.j)
        },
        h = l.m.Kb,
        l.j[h] = l.m,
        l.j.fn = {},
        l.j.fn[h] = l.j,
        l.b("dependentObservable", l.j),
        l.b("computed", l.j),
        l.b("isComputed", l.Bb),
        l.gb = function (n) {
            return 0 == arguments.length && u(Error("When calling ko.toJS, pass the object you want to convert.")),
                yt(n, function (n) {
                    for (var t = 0; l.$(n) && 10 > t; t++) n = n();
                    return n
                })
        },
        l.toJSON = function (n, t, i) {
            return n = l.gb(n),
                l.a.xa(n, t, i)
        },
        l.b("toJS", l.gb),
        l.b("toJSON", l.toJSON),
        l.k = {
            q: function (t) {
                switch (l.a.u(t)) {
                    case "option":
                        return t.__ko__hasDomDataOptionValue__ === n ? l.a.f.get(t, l.c.options.sa) : 7 >= l.a.Z ? t.getAttributeNode("value").specified ? t.value : t.text : t.value;
                    case "select":
                        return 0 <= t.selectedIndex ? l.k.q(t.options[t.selectedIndex]) : r;
                    default:
                        return t.value
                }
            },
            T: function (i, u) {
                switch (l.a.u(i)) {
                    case "option":
                        switch (typeof u) {
                            case "string":
                                l.a.f.set(i, l.c.options.sa, r),
                            "__ko__hasDomDataOptionValue__" in i && delete i.__ko__hasDomDataOptionValue__,
                            i.value = u;
                                break;
                            default:
                                l.a.f.set(i, l.c.options.sa, u),
                            i.__ko__hasDomDataOptionValue__ = n,
                            i.value = "number" == typeof u ? u : ""
                        }
                        break;
                    case "select":
                        for (var f = i.options.length - 1; 0 <= f; f--) if (l.k.q(i.options[f]) == u) {
                            i.selectedIndex = f;
                            break
                        }
                        break;
                    default:
                        (u === t || u === r) && (u = ""),
                        i.value = u
                }
            }
        },
        l.b("selectExtensions", l.k),
        l.b("selectExtensions.readValue", l.k.q),
        l.b("selectExtensions.writeValue", l.k.T);
        var ti = /\@ko_token_(\d+)\@/g,
            ii = ["true", "false"],
            ri = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;
        l.g = {
            Q: [],
            aa: function (n) {
                var i = l.a.D(n),
                        f, e, r, u;
                if (3 > i.length) return [];
                for ("{" === i.charAt(0) && (i = i.substring(1, i.length - 1)), n = [], f = t, r = 0; r < i.length; r++) if (u = i.charAt(r), f === t) switch (u) {
                    case '"':
                    case "'":
                    case "/":
                        f = r,
                            e = u
                } else if (u == e && "\\" !== i.charAt(r - 1)) {
                    u = i.substring(f, r + 1),
                            n.push(u);
                    var h = "@ko_token_" + (n.length - 1) + "@",
                                i = i.substring(0, f) + h + i.substring(r + 1),
                                r = r - (u.length - h.length),
                                f = t
                }
                e = f = t;
                for (var o = 0, s = t, r = 0; r < i.length; r++) {
                    if (u = i.charAt(r), f === t) switch (u) {
                        case "{":
                            f = r,
                                s = u,
                                e = "}";
                            break;
                        case "(":
                            f = r,
                                s = u,
                                e = ")";
                            break;
                        case "[":
                            f = r,
                                s = u,
                                e = "]"
                    }
                    u === s ? o++ : u === e && (o--, 0 === o && (u = i.substring(f, r + 1), n.push(u), h = "@ko_token_" + (n.length - 1) + "@", i = i.substring(0, f) + h + i.substring(r + 1), r -= u.length - h.length, f = t))
                }
                for (e = [], i = i.split(","), f = 0, r = i.length; f < r; f++) o = i[f],
                    s = o.indexOf(":"),
                    0 < s && s < o.length - 1 ? (u = o.substring(s + 1), e.push({
                        key: g(o.substring(0, s), n),
                        value: g(u, n)
                    })) : e.push({
                        unknown: g(o, n)
                    });
                return e
            },
            ba: function (n) {
                var e = "string" == typeof n ? l.g.aa(n) : n,
                        f = [],
                        r, s, o, u;
                for (n = [], s = 0; r = e[s]; s++) if (0 < f.length && f.push(","), r.key) {
                    n: 
                    {
                        o = r.key,
                                u = l.a.D(o);
                        switch (u.length && u.charAt(0)) {
                            case "'":
                            case '"':
                                break n;
                            default:
                                o = "'" + u + "'"
                        }
                    }
                    r = r.value,
                            f.push(o),
                            f.push(":"),
                            f.push(r),
                            r = l.a.D(r),
                            0 <= l.a.i(ii, l.a.D(r).toLowerCase()) ? r = i : (u = r.match(ri), r = u === t ? i : u[1] ? "Object(" + u[1] + ")" + u[2] : r),
                            r && (0 < n.length && n.push(", "), n.push(o + " : function(__ko_value) { " + r + " = __ko_value; }"))
                } else r.unknown && f.push(r.unknown);
                return e = f.join(""),
                    0 < n.length && (e = e + ", '_ko_property_writers' : { " + n.join("") + " } "),
                    e
            },
            Eb: function (t, r) {
                for (var u = 0; u < t.length; u++) if (l.a.D(t[u].key) == r) return n;
                return i
            },
            ea: function (n, t, i, r, u) {
                n && l.Ra(n) ? u && n.t() === r || n(r) : (n = t()._ko_property_writers) && n[i] && n[i](r)
            }
        },
        l.b("expressionRewriting", l.g),
        l.b("expressionRewriting.bindingRewriteValidators", l.g.Q),
        l.b("expressionRewriting.parseObjectLiteral", l.g.aa),
        l.b("expressionRewriting.preProcessBindings", l.g.ba),
        l.b("jsonExpressionRewriting", l.g),
        l.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson", l.g.ba);
        var b = "<!--test-->" === e.createComment("test").text,
            ui = b ? /^\x3c!--\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*--\x3e$/ : /^\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*$/,
            fi = b ? /^\x3c!--\s*\/ko\s*--\x3e$/ : /^\s*\/ko\s*$/,
            ei = {
                ul: n,
                ol: n
            };
        l.e = {
            I: {},
            childNodes: function (n) {
                return a(n) ? vt(n) : n.childNodes
            },
            Y: function (n) {
                if (a(n)) {
                    n = l.e.childNodes(n);
                    for (var t = 0, i = n.length; t < i; t++) l.removeNode(n[t])
                } else l.a.ka(n)
            },
            N: function (n, t) {
                if (a(n)) {
                    l.e.Y(n);
                    for (var r = n.nextSibling, i = 0, u = t.length; i < u; i++) r.parentNode.insertBefore(t[i], r)
                } else l.a.N(n, t)
            },
            Va: function (n, t) {
                a(n) ? n.parentNode.insertBefore(t, n.nextSibling) : n.firstChild ? n.insertBefore(t, n.firstChild) : n.appendChild(t)
            },
            Pa: function (n, t, i) {
                i ? a(n) ? n.parentNode.insertBefore(t, i.nextSibling) : i.nextSibling ? n.insertBefore(t, i.nextSibling) : n.appendChild(t) : l.e.Va(n, t)
            },
            firstChild: function (n) {
                return a(n) ? !n.nextSibling || p(n.nextSibling) ? t : n.nextSibling : n.firstChild
            },
            nextSibling: function (n) {
                return a(n) && (n = at(n)),
                    n.nextSibling && p(n.nextSibling) ? t : n.nextSibling
            },
            jb: function (n) {
                return (n = a(n)) ? n[1] : t
            },
            Ta: function (i) {
                var e, r, u, f;
                if (ei[l.a.u(i)] && (e = i.firstChild, e)) do
                    if (1 === e.nodeType) {
                        if (r = e.firstChild, u = t, r) do u ? u.push(r) : a(r) ? (f = at(r, n), f ? r = f : u = [r]) : p(r) && (u = [r]);
                        while (r = r.nextSibling);
                        if (r = u) for (u = e.nextSibling, f = 0; f < r.length; f++) u ? i.insertBefore(r[f], u) : i.appendChild(r[f])
                    }
                while (e = e.nextSibling)
            }
        },
        l.b("virtualElements", l.e),
        l.b("virtualElements.allowedBindings", l.e.I),
        l.b("virtualElements.emptyNode", l.e.Y),
        l.b("virtualElements.insertAfter", l.e.Pa),
        l.b("virtualElements.prepend", l.e.Va),
        l.b("virtualElements.setDomNodeChildren", l.e.N),
        l.J = function () {
            this.Ha = {}
        },
        l.a.extend(l.J.prototype, {
            nodeHasBindings: function (n) {
                switch (n.nodeType) {
                    case 1:
                        return n.getAttribute("data-bind") != t;
                    case 8:
                        return l.e.jb(n) != t;
                    default:
                        return i
                }
            },
            getBindings: function (n, i) {
                var r = this.getBindingsString(n, i);
                return r ? this.parseBindingsString(r, i, n) : t
            },
            getBindingsString: function (n) {
                switch (n.nodeType) {
                    case 1:
                        return n.getAttribute("data-bind");
                    case 8:
                        return l.e.jb(n);
                    default:
                        return t
                }
            },
            parseBindingsString: function (n, t, i) {
                var r, f, e, o;
                try {
                    return (r = this.Ha[n]) || (f = this.Ha, o = "with($context){with($data||{}){return{" + l.g.ba(n) + "}}}", e = new Function("$context", "$element", o), r = f[n] = e),
                        r(t, i)
                } catch (s) {
                    u(Error("Unable to parse bindings.\nMessage: " + s + ";\nBindings value: " + n))
                }
            }
        }),
        l.J.instance = new l.J,
        l.b("bindingProvider", l.J),
        l.c = {},
        l.z = function (n, t, i) {
            t ? (l.a.extend(this, t), this.$parentContext = t, this.$parent = t.$data, this.$parents = (t.$parents || []).slice(0), this.$parents.unshift(this.$parent)) : (this.$parents = [], this.$root = n, this.ko = l),
                this.$data = n,
                i && (this[i] = n)
        },
        l.z.prototype.createChildContext = function (n, t) {
            return new l.z(n, this, t)
        },
        l.z.prototype.extend = function (n) {
            var t = l.a.extend(new l.z, this);
            return l.a.extend(t, n)
        },
        l.eb = function (n, t) {
            if (2 == arguments.length) l.a.f.set(n, "__ko_bindingContext__", t);
            else return l.a.f.get(n, "__ko_bindingContext__")
        },
        l.Fa = function (t, i, r) {
            return 1 === t.nodeType && l.e.Ta(t),
                ht(t, i, r, n)
        },
        l.Ea = function (t, i) {
            (1 === i.nodeType || 8 === i.nodeType) && lt(t, i, n)
        },
        l.Da = function (t, i) {
            i && 1 !== i.nodeType && 8 !== i.nodeType && u(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node")),
                i = i || o.document.body,
                ct(t, i, n)
        },
        l.ja = function (n) {
            switch (n.nodeType) {
                case 1:
                case 8:
                    var t = l.eb(n);
                    if (t) return t;
                    if (n.parentNode) return l.ja(n.parentNode)
            }
            return r
        },
        l.pb = function (n) {
            return (n = l.ja(n)) ? n.$data : r
        },
        l.b("bindingHandlers", l.c),
        l.b("applyBindings", l.Da),
        l.b("applyBindingsToDescendants", l.Ea),
        l.b("applyBindingsToNode", l.Fa),
        l.b("contextFor", l.ja),
        l.b("dataFor", l.pb),
        tt = {
            "class": "className",
            "for": "htmlFor"
        },
        l.c.attr = {
            update: function (n, u) {
                var s = l.a.d(u()) || {},
                        f, e, o;
                for (f in s) "string" == typeof f && (e = l.a.d(s[f]), o = e === i || e === t || e === r, o && n.removeAttribute(f), 8 >= l.a.Z && f in tt ? (f = tt[f], o ? n.removeAttribute(f) : n[f] = e) : o || n.setAttribute(f, e.toString()), "name" === f && l.a.ab(n, o ? "" : e.toString()))
            }
        },
        l.c.checked = {
            init: function (t, i, r) {
                l.a.n(t, "click", function () {
                    var u, f, e;
                    if ("checkbox" == t.type) u = t.checked;
                    else if ("radio" == t.type && t.checked) u = t.value;
                    else return;
                    f = i(),
                        e = l.a.d(f),
                        "checkbox" == t.type && e instanceof Array ? (u = l.a.i(e, t.value), t.checked && 0 > u ? f.push(t.value) : !t.checked && 0 <= u && f.splice(u, 1)) : l.g.ea(f, r, "checked", u, n)
                }),
                    "radio" != t.type || t.name || l.c.uniqueName.init(t, s(n))
            },
            update: function (n, t) {
                var i = l.a.d(t());
                "checkbox" == n.type ? n.checked = i instanceof Array ? 0 <= l.a.i(i, n.value) : i : "radio" == n.type && (n.checked = n.value == i)
            }
        },
        l.c.css = {
            update: function (t, r) {
                var u = l.a.d(r()),
                        f, e;
                if ("object" == typeof u) for (f in u) e = l.a.d(u[f]),
                    l.a.da(t, f, e);
                else u = String(u || ""),
                    l.a.da(t, t.__ko__cssValue, i),
                    t.__ko__cssValue = u,
                    l.a.da(t, u, n)
            }
        },
        l.c.enable = {
            update: function (t, i) {
                var r = l.a.d(i());
                r && t.disabled ? t.removeAttribute("disabled") : !r && !t.disabled && (t.disabled = n)
            }
        },
        l.c.disable = {
            update: function (n, t) {
                l.c.enable.update(n, function () {
                    return !l.a.d(t())
                })
            }
        },
        l.c.event = {
            init: function (t, r, u, f) {
                var o = r() || {},
                        e;
                for (e in o) (function () {
                    var o = e;
                    "string" == typeof o && l.a.n(t, o, function (t) {
                        var s, h = r()[o],
                                    c, e;
                        if (h) {
                            c = u();
                            try {
                                e = l.a.L(arguments),
                                            e.unshift(f),
                                            s = h.apply(f, e)
                            } finally {
                                s !== n && (t.preventDefault ? t.preventDefault() : t.returnValue = i)
                            }
                            c[o + "Bubble"] === i && (t.cancelBubble = n, t.stopPropagation && t.stopPropagation())
                        }
                    })
                })()
            }
        },
        l.c.foreach = {
            Sa: function (n) {
                return function () {
                    var i = n(),
                            t = l.a.ua(i);
                    return !t || "number" == typeof t.length ? {
                        foreach: i,
                        templateEngine: l.C.oa
                    } : (l.a.d(i), {
                        foreach: t.data,
                        as: t.as,
                        includeDestroyed: t.includeDestroyed,
                        afterAdd: t.afterAdd,
                        beforeRemove: t.beforeRemove,
                        afterRender: t.afterRender,
                        beforeMove: t.beforeMove,
                        afterMove: t.afterMove,
                        templateEngine: l.C.oa
                    })
                }
            },
            init: function (n, t) {
                return l.c.template.init(n, l.c.foreach.Sa(t))
            },
            update: function (n, t, i, r, u) {
                return l.c.template.update(n, l.c.foreach.Sa(t), i, r, u)
            }
        },
        l.g.Q.foreach = i,
        l.e.I.foreach = n,
        l.c.hasfocus = {
            init: function (r, u, f) {
                function e(t) {
                    r.__ko_hasfocusUpdating = n;
                    var e = r.ownerDocument;
                    "activeElement" in e && (t = e.activeElement === r),
                        e = u(),
                        l.g.ea(e, f, "hasfocus", t, n),
                        r.__ko_hasfocusUpdating = i
                }
                var o = e.bind(t, n),
                        s = e.bind(t, i);
                l.a.n(r, "focus", o),
                    l.a.n(r, "focusin", o),
                    l.a.n(r, "blur", s),
                    l.a.n(r, "focusout", s)
            },
            update: function (n, i) {
                var r = l.a.d(i());
                n.__ko_hasfocusUpdating || (r ? n.focus() : n.blur(), l.r.K(l.a.Ba, t, [n, r ? "focusin" : "focusout"]))
            }
        },
        l.c.html = {
            init: function () {
                return {
                    controlsDescendantBindings: n
                }
            },
            update: function (n, t) {
                l.a.ca(n, t())
            }
        },
        it = "__ko_withIfBindingData",
        nt("if"),
        nt("ifnot", i, n),
        nt("with", n, i, function (n, t) {
            return n.createChildContext(t)
        }),
        l.c.options = {
            update: function (t, i, f) {
                var c, h, a, s;
                "select" !== l.a.u(t) && u(Error("options binding applies only to SELECT elements"));
                for (var p = 0 == t.length, w = l.a.V(l.a.fa(t.childNodes, function (n) {
                    return n.tagName && "option" === l.a.u(n) && n.selected
                }), function (n) {
                    return l.k.q(n) || n.innerText || n.textContent
                }), b = t.scrollTop, o = l.a.d(i()); 0 < t.length; ) l.A(t.options[0]),
                    t.remove(0);
                if (o) {
                    for (f = f(), c = f.optionsIncludeDestroyed, "number" != typeof o.length && (o = [o]), f.optionsCaption && (h = e.createElement("option"), l.a.ca(h, f.optionsCaption), l.k.T(h, r), t.appendChild(h)), i = 0, a = o.length; i < a; i++) if (s = o[i], !s || !s._destroy || c) {
                        var h = e.createElement("option"),
                                v = function (n, t, i) {
                                    var r = typeof t;
                                    return "function" == r ? t(n) : "string" == r ? n[t] : i
                                },
                                y = v(s, f.optionsValue, s);
                        l.k.T(h, l.a.d(y)),
                            s = v(s, f.optionsText, y),
                            l.a.cb(h, s),
                            t.appendChild(h)
                    }
                    for (o = t.getElementsByTagName("option"), i = c = 0, a = o.length; i < a; i++) 0 <= l.a.i(w, l.k.q(o[i])) && (l.a.bb(o[i], n), c++);
                    t.scrollTop = b,
                        p && "value" in f && wt(t, l.a.ua(f.value), n),
                        l.a.ub(t)
                }
            }
        },
        l.c.options.sa = "__ko.optionValueDomData__",
        l.c.selectedOptions = {
            init: function (n, t, i) {
                l.a.n(n, "change", function () {
                    var u = t(),
                            r = [];
                    l.a.o(n.getElementsByTagName("option"), function (n) {
                        n.selected && r.push(l.k.q(n))
                    }),
                        l.g.ea(u, i, "value", r)
                })
            },
            update: function (n, t) {
                "select" != l.a.u(n) && u(Error("values binding applies only to SELECT elements"));
                var i = l.a.d(t());
                i && "number" == typeof i.length && l.a.o(n.getElementsByTagName("option"), function (n) {
                    var t = 0 <= l.a.i(i, l.k.q(n));
                    l.a.bb(n, t)
                })
            }
        },
        l.c.style = {
            update: function (n, t) {
                var r = l.a.d(t() || {}),
                        i, u;
                for (i in r) "string" == typeof i && (u = l.a.d(r[i]), n.style[i] = u || "")
            }
        },
        l.c.submit = {
            init: function (t, r, f, e) {
                "function" != typeof r() && u(Error("The value for a submit binding must be a function")),
                    l.a.n(t, "submit", function (u) {
                        var f, o = r();
                        try {
                            f = o.call(e, t)
                        } finally {
                            f !== n && (u.preventDefault ? u.preventDefault() : u.returnValue = i)
                        }
                    })
            }
        },
        l.c.text = {
            update: function (n, t) {
                l.a.cb(n, t())
            }
        },
        l.e.I.text = n,
        l.c.uniqueName = {
            init: function (n, t) {
                if (t()) {
                    var i = "ko_unique_" + ++l.c.uniqueName.ob;
                    l.a.ab(n, i)
                }
            }
        },
        l.c.uniqueName.ob = 0,
        l.c.value = {
            init: function (t, r, u) {
                function o() {
                    s = i;
                    var n = r(),
                            f = l.k.q(t);
                    l.g.ea(n, u, "value", f)
                }
                var f = ["change"],
                        e = u().valueUpdate,
                        s = i;
                e && ("string" == typeof e && (e = [e]), l.a.P(f, e), f = l.a.Ga(f)),
                    l.a.Z && "input" == t.tagName.toLowerCase() && "text" == t.type && "off" != t.autocomplete && (!t.form || "off" != t.form.autocomplete) && -1 == l.a.i(f, "propertychange") && (l.a.n(t, "propertychange", function () {
                        s = n
                    }), l.a.n(t, "blur", function () {
                        s && o()
                    })),
                    l.a.o(f, function (n) {
                        var i = o;
                        l.a.Ob(n, "after") && (i = function () {
                            setTimeout(o, 0)
                        }, n = n.substring(5)),
                            l.a.n(t, n, i)
                    })
            },
            update: function (t, r) {
                var e = "select" === l.a.u(t),
                        f = l.a.d(r()),
                        u = l.k.q(t),
                        o = f != u;
                0 === f && 0 !== u && "0" !== u && (o = n),
                    o && (u = function () {
                        l.k.T(t, f)
                    }, u(), e && setTimeout(u, 0)),
                    e && 0 < t.length && wt(t, f, i)
            }
        },
        l.c.visible = {
            update: function (n, t) {
                var i = l.a.d(t()),
                        r = "none" != n.style.display;
                i && !r ? n.style.display = "" : !i && r && (n.style.display = "none")
            }
        },
        l.c.click = {
            init: function (n, t, i, r) {
                return l.c.event.init.call(this, n, function () {
                    var n = {};
                    return n.click = t(),
                        n
                }, i, r)
            }
        },
        l.v = function () { },
        l.v.prototype.renderTemplateSource = function () {
            u(Error("Override renderTemplateSource"))
        },
        l.v.prototype.createJavaScriptEvaluatorBlock = function () {
            u(Error("Override createJavaScriptEvaluatorBlock"))
        },
        l.v.prototype.makeTemplateSource = function (n, t) {
            if ("string" == typeof n) {
                t = t || e;
                var i = t.getElementById(n);
                return i || u(Error("Cannot find template with ID " + n)),
                    new l.l.h(i)
            }
            if (1 == n.nodeType || 8 == n.nodeType) return new l.l.O(n);
            u(Error("Unknown template type: " + n))
        },
        l.v.prototype.renderTemplate = function (n, t, i, r) {
            return n = this.makeTemplateSource(n, r),
                this.renderTemplateSource(n, t, i)
        },
        l.v.prototype.isTemplateRewritten = function (t, r) {
            return this.allowTemplateRewriting === i ? n : this.makeTemplateSource(t, r).data("isRewritten")
        },
        l.v.prototype.rewriteTemplate = function (t, i, r) {
            t = this.makeTemplateSource(t, r),
                i = i(t.text()),
                t.text(i),
                t.data("isRewritten", n)
        },
        l.b("templateEngine", l.v),
        kt = /(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi,
        dt = /\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g,
        l.za = {
            vb: function (n, t, i) {
                t.isTemplateRewritten(n, i) || t.rewriteTemplate(n, function (n) {
                    return l.za.Gb(n, t)
                }, i)
            },
            Gb: function (n, t) {
                return n.replace(kt, function (n, i, r, u, f, e, o) {
                    return st(o, i, t)
                }).replace(dt, function (n, i) {
                    return st(i, "<!-- ko -->", t)
                })
            },
            kb: function (n) {
                return l.s.ra(function (t, i) {
                    t.nextSibling && l.Fa(t.nextSibling, n, i)
                })
            }
        },
        l.b("__tr_ambtns", l.za.kb),
        l.l = {},
        l.l.h = function (n) {
            this.h = n
        },
        l.l.h.prototype.text = function () {
            var n = l.a.u(this.h),
                    n = "script" === n ? "text" : "textarea" === n ? "value" : "innerHTML",
                    t;
            if (0 == arguments.length) return this.h[n];
            t = arguments[0],
                "innerHTML" === n ? l.a.ca(this.h, t) : this.h[n] = t
        },
        l.l.h.prototype.data = function (n) {
            if (1 === arguments.length) return l.a.f.get(this.h, "templateSourceData_" + n);
            l.a.f.set(this.h, "templateSourceData_" + n, arguments[1])
        },
        l.l.O = function (n) {
            this.h = n
        },
        l.l.O.prototype = new l.l.h,
        l.l.O.prototype.text = function () {
            if (0 == arguments.length) {
                var n = l.a.f.get(this.h, "__ko_anon_template__") || {};
                return n.Aa === r && n.ia && (n.Aa = n.ia.innerHTML),
                    n.Aa
            }
            l.a.f.set(this.h, "__ko_anon_template__", {
                Aa: arguments[0]
            })
        },
        l.l.h.prototype.nodes = function () {
            if (0 == arguments.length) return (l.a.f.get(this.h, "__ko_anon_template__") || {}).ia;
            l.a.f.set(this.h, "__ko_anon_template__", {
                ia: arguments[0]
            })
        },
        l.b("templateSources", l.l),
        l.b("templateSources.domElement", l.l.h),
        l.b("templateSources.anonymousTemplate", l.l.O),
        l.wa = function (n) {
            n == r || n instanceof l.v || u(Error("templateEngine must inherit from ko.templateEngine")),
                rt = n
        },
        l.va = function (n, i, f, e, o) {
            if (f = f || {}, (f.templateEngine || rt) == r && u(Error("Set a template engine before calling renderTemplate")), o = o || "replaceChildren", e) {
                var s = d(e);
                return l.j(function () {
                    var t = i && i instanceof l.z ? i : new l.z(l.a.d(i)),
                            r = "function" == typeof n ? n(t.$data, t) : n,
                            t = ft(e, o, r, t, f);
                    "replaceNode" == o && (e = t, s = d(e))
                }, t, {
                    Ka: function () {
                        return !s || !l.a.X(s)
                    },
                    W: s && "replaceNode" == o ? s.parentNode : s
                })
            }
            return l.s.ra(function (t) {
                l.va(n, i, f, t, "replaceNode")
            })
        },
        l.Mb = function (n, i, u, f, e) {
            function s(n, t) {
                et(t, o),
                    u.afterRender && u.afterRender(t, n)
            }
            function h(i, r) {
                o = e.createChildContext(l.a.d(i), u.as),
                    o.$index = r;
                var f = "function" == typeof n ? n(i, o) : n;
                return ft(t, "ignoreTargetNode", f, o, u)
            }
            var o;
            return l.j(function () {
                var n = l.a.d(i) || [];
                "undefined" == typeof n.length && (n = [n]),
                    n = l.a.fa(n, function (n) {
                        return u.includeDestroyed || n === r || n === t || !l.a.d(n._destroy)
                    }),
                    l.r.K(l.a.$a, t, [f, n, h, u, s])
            }, t, {
                W: f
            })
        },
        l.c.template = {
            init: function (t, i) {
                var r = l.a.d(i());
                return "string" == typeof r || r.name || 1 != t.nodeType && 8 != t.nodeType || (r = 1 == t.nodeType ? t.childNodes : l.e.childNodes(t), r = l.a.Hb(r), new l.l.O(t).nodes(r)),
                    {
                        controlsDescendantBindings: n
                    }
            },
            update: function (i, u, f, e, o) {
                u = l.a.d(u()),
                    f = {},
                    e = n;
                var s, h = t;
                "string" != typeof u && (f = u, u = f.name, "if" in f && (e = l.a.d(f["if"])), e && "ifnot" in f && (e = !l.a.d(f.ifnot)), s = l.a.d(f.data)),
                    "foreach" in f ? h = l.Mb(u || i, e && f.foreach || [], f, i, o) : e ? (o = "data" in f ? o.createChildContext(s, f.as) : o, h = l.va(u || i, o, f, i)) : l.e.Y(i),
                    o = h,
                    (s = l.a.f.get(i, "__ko__templateComputedDomDataKey__")) && "function" == typeof s.B && s.B(),
                    l.a.f.set(i, "__ko__templateComputedDomDataKey__", o && o.pa() ? o : r)
            }
        },
        l.g.Q.template = function (n) {
            return n = l.g.aa(n),
                1 == n.length && n[0].unknown || l.g.Eb(n, "name") ? t : "This template engine does not support anonymous templates nested within its templates"
        },
        l.e.I.template = n,
        l.b("setTemplateEngine", l.wa),
        l.b("renderTemplate", l.va),
        l.a.Ja = function (n, t, i) {
            return n = n || [],
                t = t || [],
                n.length <= t.length ? ut(n, t, "added", "deleted", i) : ut(t, n, "deleted", "added", i)
        },
        l.b("utils.compareArrays", l.a.Ja),
        l.a.$a = function (t, i, u, f, e) {
            function rt(n, t) {
                o = b[t],
                    g !== t && (tt[n] = o),
                    o.na(g++),
                    k(o.M),
                    d.push(o),
                    v.push(o)
            }
            function a(n, t) {
                if (n) for (var i = 0, r = t.length; i < r; i++) t[i] && l.a.o(t[i].M, function (r) {
                    n(r, i, t[i].U)
                })
            }
            var s, w, ut;
            i = i || [],
                f = f || {};
            var w = l.a.f.get(t, "setDomNodeChildrenFromArrayMapping_lastMappingResult") === r,
                    b = l.a.f.get(t, "setDomNodeChildrenFromArrayMapping_lastMappingResult") || [],
                    it = l.a.V(b, function (n) {
                        return n.U
                    }),
                    h = l.a.Ja(it, i),
                    d = [],
                    c = 0,
                    g = 0,
                    nt = [],
                    v = [];
            i = [];
            for (var tt = [], it = [], o, s = 0, y, p; y = h[s]; s++) switch (p = y.moved, y.status) {
                case "deleted":
                    p === r && (o = b[c], o.j && o.j.B(), nt.push.apply(nt, k(o.M)), f.beforeRemove && (i[s] = o, v.push(o))),
                        c++;
                    break;
                case "retained":
                    rt(s, c++);
                    break;
                case "added":
                    p !== r ? rt(s, p) : (o = {
                        U: y.value,
                        na: l.m(g++)
                    }, d.push(o), v.push(o), w || (it[s] = o))
            }
            for (a(f.beforeMove, tt), l.a.o(nt, f.beforeRemove ? l.A : l.removeNode), s = 0, w = l.e.firstChild(t); o = v[s]; s++) {
                for (o.M || l.a.extend(o, gt(t, u, o.U, e, o.na)), c = 0; h = o.M[c]; w = h.nextSibling, ut = h, c++) h !== w && l.e.Pa(t, h, ut);
                !o.Ab && e && (e(o.U, o.M, o.na), o.Ab = n)
            }
            a(f.beforeRemove, i),
                a(f.afterMove, tt),
                a(f.afterAdd, it),
                l.a.f.set(t, "setDomNodeChildrenFromArrayMapping_lastMappingResult", d)
        },
        l.b("utils.setDomNodeChildrenFromArrayMapping", l.a.$a),
        l.C = function () {
            this.allowTemplateRewriting = i
        },
        l.C.prototype = new l.v,
        l.C.prototype.renderTemplateSource = function (i) {
            var r = !(9 > l.a.Z) && i.nodes ? i.nodes() : t;
            return r ? l.a.L(r.cloneNode(n).childNodes) : (i = i.text(), l.a.ta(i))
        },
        l.C.oa = new l.C,
        l.wa(l.C.oa),
        l.b("nativeTemplateEngine", l.C),
        l.qa = function () {
            var n = this.Db = function () {
                if ("undefined" == typeof f || !f.tmpl) return 0;
                try {
                    if (0 <= f.tmpl.tag.tmpl.open.toString().indexOf("__")) return 2
                } catch (n) { }
                return 1
            } ();
            this.renderTemplateSource = function (i, r, o) {
                o = o || {},
                    2 > n && u(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));
                var s = i.data("precompiled");
                return s || (s = i.text() || "", s = f.template(t, "{{ko_with $item.koBindingContext}}" + s + "{{/ko_with}}"), i.data("precompiled", s)),
                    i = [r.$data],
                    r = f.extend({
                        koBindingContext: r
                    }, o.templateOptions),
                    r = f.tmpl(s, i, r),
                    r.appendTo(e.createElement("div")),
                    f.fragments = {},
                    r
            },
                this.createJavaScriptEvaluatorBlock = function (n) {
                    return "{{ko_code ((function() { return " + n + " })()) }}"
                },
                this.addTemplate = function (n, t) {
                    e.write("<script type='text/html' id='" + n + "'>" + t + "<\/script>")
                },
                0 < n && (f.tmpl.tag.ko_code = {
                    open: "__.push($1 || '');"
                }, f.tmpl.tag.ko_with = {
                    open: "with($1) {",
                    close: "} "
                })
        },
        l.qa.prototype = new l.v,
        h = new l.qa,
        0 < h.Db && l.wa(h),
        l.b("jqueryTmplTemplateEngine", l.qa)
    }
    var n = !0,
        t = null,
        i = !1,
        o = window,
        e = document,
        c = navigator,
        f = window.jQuery,
        r = void 0;
    "function" == typeof require && "object" == typeof exports && "object" == typeof module ? h(module.exports || exports) : "function" == typeof define && define.amd ? define(["exports"], h) : h(o.ko = {}),
    n
} (),


function (n) {
    "function" == typeof require && "object" == typeof exports && "object" == typeof module ? n(require("knockout"), exports) : "function" == typeof define && define.amd ? define(["knockout", "exports"], n) : n(ko, ko.mapping = {})
} (function (n, t) {
    function v(n, i) {
        var o, r;
        for (r in i) if (i.hasOwnProperty(r) && i[r]) if (o = t.getType(n[r]), r && n[r] && "array" !== o && "string" !== o) v(n[r], i[r]);
        else if ("array" === t.getType(n[r]) && "array" === t.getType(i[r])) {
            o = n;
            for (var h = r, f = n[r], e = i[r], s = {}, u = f.length - 1; 0 <= u; --u) s[f[u]] = f[u];
            for (u = e.length - 1; 0 <= u; --u) s[e[u]] = e[u];
            f = [],
            e = void 0;
            for (e in s) f.push(s[e]);
            o[h] = f
        } else n[r] = i[r]
    }
    function e(n, t) {
        var i = {};
        return v(i, n),
        v(i, t),
        i
    }
    function y(n, t) {
        for (var f, i = e({}, n), o = nt.length - 1; 0 <= o; o--) f = nt[o],
        i[f] && (i[""] instanceof Object || (i[""] = {}), i[""][f] = i[f], delete i[f]);
        return t && (i.ignore = u(t.ignore, i.ignore), i.include = u(t.include, i.include), i.copy = u(t.copy, i.copy), i.observe = u(t.observe, i.observe)),
        i.ignore = u(i.ignore, r.ignore),
        i.include = u(i.include, r.include),
        i.copy = u(i.copy, r.copy),
        i.observe = u(i.observe, r.observe),
        i.mappedProperties = i.mappedProperties || {},
        i.copiedProperties = i.copiedProperties || {},
        i
    }
    function u(i, r) {
        return "array" !== t.getType(i) && (i = "undefined" === t.getType(i) ? [] : [i]),
        "array" !== t.getType(r) && (r = "undefined" === t.getType(r) ? [] : [r]),
        n.utils.arrayGetDistinctValues(i.concat(r))
    }
    function o(r, u, a, v, y, p, b) {
        var yt = "array" === t.getType(n.utils.unwrapObservable(u)),
            nt, it, rt, et, ht;
        p = p || "",
        t.isMapped(r) && (nt = n.utils.unwrapObservable(r)[i], a = e(nt, a));
        var at = b || y,
            ct = function () {
                return a[v] && a[v].create instanceof Function
            },
            vt = function (t) {
                var i = c,
                    r = n.dependentObservable;
                return n.dependentObservable = function (t, r, u) {
                    var o, f, e;
                    return u = u || {},
                        t && "object" == typeof t && (u = t),
                        e = u.deferEvaluation,
                        o = !1,
                        u.deferEvaluation = !0,
                        t = new h(t, r, u),
                        e || (f = t, e = n.dependentObservable, n.dependentObservable = h, t = n.isWriteableObservable(f), n.dependentObservable = e, e = h({
                            read: function () {
                                return o || (n.utils.arrayRemoveItem(i, f), o = !0),
                                f.apply(f, arguments)
                            },
                            write: t &&
                            function (n) {
                                return f(n)
                            },
                            deferEvaluation: !0
                        }), e.__DO = f, t = e, i.push(t)),
                        t
                },
                n.dependentObservable.fn = h.fn,
                n.computed = n.dependentObservable,
                t = n.utils.unwrapObservable(y) instanceof Array ? a[v].create({
                    data: t || u,
                    parent: at,
                    skip: tt
                }) : a[v].create({
                    data: t || u,
                    parent: at
                }),
                n.dependentObservable = r,
                n.computed = n.dependentObservable,
                t
            },
            ft = function () {
                return a[v] && a[v].update instanceof Function
            },
            ot = function (t, i) {
                var r = {
                    data: i || u,
                    parent: at,
                    target: n.utils.unwrapObservable(t)
                };
                return n.isWriteableObservable(t) && (r.observable = t),
                a[v].update(r)
            };
        if (b = l.get(u)) return b;
        if (v = v || "", yt) {
            var yt = [],
                    ut = !1,
                    g = function (n) {
                        return n
                    };
            a[v] && a[v].key && (g = a[v].key, ut = !0),
                n.isObservable(r) || (r = n.observableArray([]), r.mappedRemove = function (n) {
                    var t = "function" == typeof n ? n : function (t) {
                        return t === g(n)
                    };
                    return r.remove(function (n) {
                        return t(g(n))
                    })
                }, r.mappedRemoveAll = function (t) {
                    var i = f(t, g);
                    return r.remove(function (t) {
                        return -1 != n.utils.arrayIndexOf(i, g(t))
                    })
                }, r.mappedDestroy = function (n) {
                    var t = "function" == typeof n ? n : function (t) {
                        return t === g(n)
                    };
                    return r.destroy(function (n) {
                        return t(g(n))
                    })
                }, r.mappedDestroyAll = function (t) {
                    var i = f(t, g);
                    return r.destroy(function (t) {
                        return -1 != n.utils.arrayIndexOf(i, g(t))
                    })
                }, r.mappedIndexOf = function (t) {
                    var i = f(r(), g);
                    return t = g(t),
                        n.utils.arrayIndexOf(i, t)
                }, r.mappedGet = function (n) {
                    return r()[r.mappedIndexOf(n)]
                }, r.mappedCreate = function (t) {
                    if (-1 !== r.mappedIndexOf(t)) throw Error("There already is an object with the key that you specified.");
                    var i = ct() ? vt(t) : t;
                    return ft() && (t = ot(i, t), n.isWriteableObservable(i) ? i(t) : i = t),
                        r.push(i),
                        i
                }),
                b = f(n.utils.unwrapObservable(r), g).sort(),
                nt = f(u, g),
                ut && nt.sort(),
                ut = n.utils.compareArrays(b, nt),
                b = {};
            for (var st = n.utils.unwrapObservable(u), pt = {}, wt = !0, nt = 0, lt = st.length; nt < lt; nt++) {
                if (it = g(st[nt]), void 0 === it || it instanceof Object) {
                    wt = !1;
                    break
                }
                pt[it] = st[nt]
            }
            var st = [],
                    bt = 0,
                    nt = 0;
            for (lt = ut.length; nt < lt; nt++) {
                it = ut[nt],
                        et = p + "[" + nt + "]";
                switch (it.status) {
                    case "added":
                        ht = wt ? pt[it.value] : s(n.utils.unwrapObservable(u), it.value, g),
                            rt = o(void 0, ht, a, v, r, et, y),
                            ct() || (rt = n.utils.unwrapObservable(rt)),
                            et = w(n.utils.unwrapObservable(u), ht, b),
                            rt === tt ? bt++ : st[et - bt] = rt,
                            b[et] = !0;
                        break;
                    case "retained":
                        ht = wt ? pt[it.value] : s(n.utils.unwrapObservable(u), it.value, g),
                            rt = s(r, it.value, g),
                            o(rt, ht, a, v, r, et, y),
                            et = w(n.utils.unwrapObservable(u), ht, b),
                            st[et] = rt,
                            b[et] = !0;
                        break;
                    case "deleted":
                        rt = s(r, it.value, g)
                }
                yt.push({
                    event: it.status,
                    item: rt
                })
            }
            r(st),
                a[v] && a[v].arrayChanged && n.utils.arrayForEach(yt, function (n) {
                    a[v].arrayChanged(n.event, n.item)
                })
        } else if (d(u)) {
            if (r = n.utils.unwrapObservable(r), !r) {
                if (ct()) return ut = vt(),
                    ft() && (ut = ot(ut)),
                    ut;
                if (ft()) return ot(ut);
                r = {}
            }
            if (ft() && (r = ot(r)), l.save(u, r), ft()) return r;
            k(u, function (t) {
                var f = p.length ? p + "." + t : t;
                if (-1 == n.utils.arrayIndexOf(a.ignore, f)) if (-1 != n.utils.arrayIndexOf(a.copy, f)) r[t] = u[t];
                else if ("object" != typeof u[t] && "array" != typeof u[t] && 0 < a.observe.length && -1 == n.utils.arrayIndexOf(a.observe, f)) r[t] = u[t],
                    a.copiedProperties[f] = !0;
                else {
                    var i = l.get(u[t]),
                            e = o(r[t], u[t], a, t, r, f, r),
                            i = i || e;
                    0 < a.observe.length && -1 == n.utils.arrayIndexOf(a.observe, f) ? (r[t] = i(), a.copiedProperties[f] = !0) : (n.isWriteableObservable(r[t]) ? (i = n.utils.unwrapObservable(i), r[t]() !== i) && r[t](i) : (i = void 0 === r[t] ? i : n.utils.unwrapObservable(i), r[t] = i), a.mappedProperties[f] = !0)
                }
            })
        } else switch (t.getType(u)) {
            case "function":
                ft() ? n.isWriteableObservable(u) ? (u(ot(u)), r = u) : r = ot(u) : r = u;
                break;
            default:
                if (n.isWriteableObservable(r)) return rt = ft() ? ot(r) : n.utils.unwrapObservable(u),
                r(rt),
                rt;
                ct() || ft(),
                r = ct() ? vt() : n.observable(n.utils.unwrapObservable(u)),
                ft() && r(ot(r))
        }
        return r
    }
    function w(n, t, i) {
        for (var r = 0, u = n.length; r < u; r++) if (!0 !== i[r] && n[r] === t) return r;
        return null
    }
    function b(i, r) {
        var u;
        return r && (u = r(i)),
        "undefined" === t.getType(u) && (u = i),
        n.utils.unwrapObservable(u)
    }
    function s(t, i, r) {
        var u, e, f;
        for (t = n.utils.unwrapObservable(t), u = 0, e = t.length; u < e; u++) if (f = t[u], b(f, r) === i) return f;
        throw Error("When calling ko.update*, the key '" + i + "' was not found!");
    }
    function f(t, i) {
        return n.utils.arrayMap(n.utils.unwrapObservable(t), function (n) {
            return i ? b(n, i) : n
        })
    }
    function k(n, i) {
        if ("array" === t.getType(n)) for (var r = 0; r < n.length; r++) i(r);
        else for (r in n) i(r)
    }
    function d(n) {
        var i = t.getType(n);
        return ("object" === i || "array" === i) && null !== n
    }
    function it() {
        var t = [],
            i = [];
        this.save = function (r, u) {
            var f = n.utils.arrayIndexOf(t, r);
            0 <= f ? i[f] = u : (t.push(r), i.push(u))
        },
        this.get = function (r) {
            return r = n.utils.arrayIndexOf(t, r),
                0 <= r ? i[r] : void 0
        }
    }
    function g() {
        var n = {},
            t = function (t) {
                var i;
                try {
                    i = t
                } catch (r) {
                    i = "$$$"
                }
                return t = n[i],
                void 0 === t && (t = new it, n[i] = t),
                t
            };
        this.save = function (n, i) {
            t(n).save(n, i)
        },
        this.get = function (n) {
            return t(n).get(n)
        }
    }
    var i = "__ko_mapping__",
        h = n.dependentObservable,
        p = 0,
        c, l, nt = ["create", "update", "key", "arrayChanged"],
        tt = {},
        a = {
            include: ["_destroy"],
            ignore: [],
            copy: [],
            observe: []
        },
        r = a;
    t.isMapped = function (t) {
        return (t = n.utils.unwrapObservable(t)) && t[i]
    },
    t.fromJS = function (n) {
        var t, r, u, f;
        if (0 == arguments.length) throw Error("When calling ko.fromJS, pass the object you want to convert.");
        try {
            if (p++ || (c = [], l = new g), 2 == arguments.length && (arguments[1][i] ? r = arguments[1] : t = arguments[1]), 3 == arguments.length && (t = arguments[1], r = arguments[2]), r && (t = e(t, r[i])), t = y(t), u = o(r, n, t), r && (u = r), ! --p) for (; c.length; ) f = c.pop(),
                f && (f(), f.__DO.throttleEvaluation = f.throttleEvaluation);
            return u[i] = e(u[i], t),
                u
        } catch (s) {
            throw p = 0,
                s;
        }
    },
    t.fromJSON = function (i) {
        var r = n.utils.parseJson(i);
        return arguments[0] = r,
            t.fromJS.apply(this, arguments)
    },
    t.updateFromJS = function () {
        throw Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");
    },
    t.updateFromJSON = function () {
        throw Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");
    },
    t.toJS = function (u, f) {
        if (r || t.resetDefaultOptions(), 0 == arguments.length) throw Error("When calling ko.mapping.toJS, pass the object you want to convert.");
        if ("array" !== t.getType(r.ignore)) throw Error("ko.mapping.defaultOptions().ignore should be an array.");
        if ("array" !== t.getType(r.include)) throw Error("ko.mapping.defaultOptions().include should be an array.");
        if ("array" !== t.getType(r.copy)) throw Error("ko.mapping.defaultOptions().copy should be an array.");
        return f = y(f, u[i]),
            t.visitModel(u, function (t) {
                return n.utils.unwrapObservable(t)
            }, f)
    },
    t.toJSON = function (i, r) {
        var u = t.toJS(i, r);
        return n.utils.stringifyJson(u)
    },
    t.defaultOptions = function () {
        if (0 < arguments.length) r = arguments[0];
        else return r
    },
    t.resetDefaultOptions = function () {
        r = {
            include: a.include.slice(0),
            ignore: a.ignore.slice(0),
            copy: a.copy.slice(0)
        }
    },
    t.getType = function (n) {
        if (n && "object" == typeof n) {
            if (n.constructor === Date) return "date";
            if (n.constructor === Array) return "array"
        }
        return typeof n
    },
    t.visitModel = function (r, u, f) {
        var o, e, s;
        if (f = f || {}, f.visitedObjects = f.visitedObjects || new g, e = n.utils.unwrapObservable(r), d(e)) f = y(f, e[i]),
            u(r, f.parentName),
            o = "array" === t.getType(e) ? [] : {};
        else return u(r, f.parentName);
        return f.visitedObjects.save(r, o),
            s = f.parentName,
            k(e, function (r) {
                if (!(f.ignore && -1 != n.utils.arrayIndexOf(f.ignore, r))) {
                    var h = e[r],
                        c = f,
                        l = s || "";
                    if ("array" === t.getType(e) ? s && (l += "[" + r + "]") : (s && (l += "."), l += r), c.parentName = l, !(-1 === n.utils.arrayIndexOf(f.copy, r) && -1 === n.utils.arrayIndexOf(f.include, r) && e[i] && e[i].mappedProperties && !e[i].mappedProperties[r] && e[i].copiedProperties && !e[i].copiedProperties[r] && "array" !== t.getType(e))) switch (t.getType(n.utils.unwrapObservable(h))) {
                        case "object":
                        case "array":
                        case "undefined":
                            c = f.visitedObjects.get(h),
                            o[r] = "undefined" !== t.getType(c) ? c : t.visitModel(h, u, f);
                            break;
                        default:
                            o[r] = u(h, f.parentName)
                    }
                }
            }),
            o
    }
}),


function (n, t) {
    var i = function (t) {
        var i = n(t);
        return n(document).find(t).length == 0 && n(parent.document).find(t).length > 0 && (i = parent.$(t)),
        i
    };
    t.creatEasyuiValueBindings = function (r) {
        r = n.extend({
            type: "",
            event: "",
            getter: "getValue",
            setter: "setValue",
            fix: n.noop,
            formatter: function (n) {
                return n
            }
        }, r);
        var u = {
            init: function (n, u) {
                var s = i(n),
                    c = s[r.type]("options")[r.event],
                    h = {};
                h[r.event] = function () {
                    c.apply(n, arguments);
                    var t = s[r.type](r.getter);
                    if (u() == null) throw "viewModel中没有页面绑定的字段";
                    u()(t)
                },
                t.utils.domNodeDisposal.addDisposeCallback(n, function () {
                    s[r.type]("destroy")
                }),
                r.fix(n, u),
                s[r.type](h)
            },
            update: function (n, u) {
                value = t.utils.unwrapObservable(u()),
                i(n)[r.type](r.setter, r.formatter(value))
            }
        };
        t.bindingHandlers[r.type + "Value"] = u
    },
    t.creatEasyuiValueBindings({
        type: "combobox",
        event: "onSelect"
    }),
    t.creatEasyuiValueBindings({
        type: "combotree",
        event: "onChange"
    }),
    t.creatEasyuiValueBindings({
        type: "datebox",
        event: "onSelect",
        formatter: com.formatDate
    }),
    t.creatEasyuiValueBindings({
        type: "lookup",
        event: "onChange"
    }),
    t.creatEasyuiValueBindings({
        type: "numberbox",
        event: "onChange"
    }),
    t.creatEasyuiValueBindings({
        type: "numberspinner",
        event: "onChange",
        fix: function (t) {
            n(t).width(n(t).width() + 20)
        }
    }),
    t.creatEasyuiEnableBindings = function (i) {
        i = n.extend({
            type: "",
            method: "Enable",
            options: function () {
                return "disabled"
            },
            value: function (n) {
                return !n
            }
        }, i);
        var r = {
            update: function (r, u) {
                var s = t.toJS(u());
                n(r)[i.type](i.options(s), i.value(s))
            }
        };
        t.bindingHandlers[i.type + i.method] = r
    },
    t.creatEasyuiEnableBindings({
        type: "linkbutton",
        options: function (n) {
            return {
                disabled: !n
            }
        }
    }),
    t.creatEasyuiEnableBindings({
        type: "linkbutton",
        method: "Disable",
        options: function (n) {
            return {
                disabled: n
            }
        }
    }),
    _readOnlyHandles = {},
    _readOnlyHandles.defaults = function (n, t) {
        t ? n.addClass("readonly").attr("readonly", !0) : n.removeClass("readonly").removeAttr("readonly")
    },
    _readOnlyHandles.combo = function (n, t) {
        n.combo(t ? "disable" : "enable")
    },
    _readOnlyHandles.spinner = function (n, t) {
        n.spinner(t ? "disable" : "enable")
    },
    t.creatEasyuiReadOnlyBindings = function (i) {
        i = n.extend({
            type: "",
            handler: _readOnlyHandles.defaults
        }, i);
        var r = {
            update: function (r, u) {
                i.handler(n(r), t.toJS(u()))
            }
        };
        t.bindingHandlers[i.type ? i.type + "ReadOnly" : "readOnly"] = r
    },
    t.creatEasyuiReadOnlyBindings(),
    t.creatEasyuiReadOnlyBindings({
        type: "numberbox"
    }),
    t.creatEasyuiReadOnlyBindings({
        type: "combobox",
        handler: _readOnlyHandles.combo
    }),
    t.creatEasyuiReadOnlyBindings({
        type: "datebox",
        handler: _readOnlyHandles.combo
    }),
    t.creatEasyuiReadOnlyBindings({
        type: "lookup",
        handler: _readOnlyHandles.combo
    }),
    t.creatEasyuiReadOnlyBindings({
        type: "combotree",
        handler: _readOnlyHandles.combo
    }),
    t.creatEasyuiReadOnlyBindings({
        type: "numberspinner",
        handler: _readOnlyHandles.spinner
    }),
    t.bindingHandlers.datasource = {
        init: function (r, u) {
            var e = i(r),
                f = t.toJS(u()),
                o;
            n.isFunction(f) && (f = f.call()),
            e.data("treegrid") ? e.treegrid("loadData", f) : e.data("datagrid") ? e.datagrid("loadData", f) : e.data("combotree") ? e.combotree("loadData", f) : e.data("combobox") ? (o = e.combobox("getValue"), f = f.rows || f, e.combobox("clear").combobox("loadData", f).combobox("setValue", o)) : e.data("tree") && e.tree("loadData", f.rows || f)
        }
    },
    t.creatEasyuiGridBindings = function (r) {
        return {
            update: function (u, f) {
                var h = i(u),
                    s = t.toJS(f()),
                    a = s.url,
                    c = function (t) {
                        if (s.pagination) {
                            var i = h.datagrid("getPager").pagination("options");
                            t = n.extend(t, {
                                page: i.pageNumber,
                                rows: i.pageSize
                            })
                        }
                        com.ajax({
                            type: "get",
                            url: a,
                            data: t,
                            success: function (t) {
                                n.isFunction(s.afterCustomSuccess) && s.afterCustomSuccess(t),
                                h[r]("loadData", t)
                            }
                        })
                    },
                    l;
                s.treeField && s.parentField && (s.loadFilter = function (n) {
                    return utils.toTreeData(n.rows || n, s.idField || s.treeField, s.parentField, "children")
                }),
                l = function () {
                    if (h.data(r)) s.customLoad ? c(s.queryParams) : h[r](s);
                    else {
                        var u = {
                            iconCls: "icon icon-list",
                            nowrap: !0,
                            rownumbers: !0,
                            striped: !0,
                            singleSelect: !0,
                            remoteSort: !0,
                            pagination: !1,
                            pageSize: parent.sys_config ? parent.sys_config.gridRows || 20 : 20,
                            contentType: "application/json",
                            method: "GET"
                        },
                                t = function (n) {
                                    var t = {};
                                    return n && n.w && (t.width = i(window).width() - n.w),
                                    n && n.h && (t.height = i(window).height() - n.h),
                                    t
                                };
                        s = n.extend(u, s, t(s.size)),
                            s.customLoad ? (s.remoteSort && (s.onSortColumn = function (t, i) {
                                c(n.extend(s.queryParams, {
                                    sort: t,
                                    order: i
                                }))
                            }), h[r](s), c(s.queryParams), s.pagination && h[r]("getPager").pagination({
                                onSelectPage: c
                            })) : h[r](s),
                            f()[r] = function () {
                                return h[r].apply(h, arguments)
                            },
                            f().$element = function () {
                                return h
                            },
                            s.size && i(window).resize(function () {
                                h[r]("resize", t(s.size))
                            })
                    }
                },
                h[r] ? l() : using([r], function () {
                    l(),
                        r == "treegrid" && com.loadCss("/Content/css/icon/icon.css", document, !0)
                })
            }
        }
    },
    t.bindingHandlers.datagrid = t.creatEasyuiGridBindings("datagrid"),
    t.bindingHandlers.treegrid = t.creatEasyuiGridBindings("treegrid"),
    t.createEasyuiInitBindings = function (r) {
        r = n.extend({
            type: ""
        }, r);
        var u = {
            init: function (n, u) {
                var s = i(n),
                    c = t.mapping.toJS(u()),
                    h = function () {
                        s[r.type](c)
                    };
                s[r.type] ? h() : using(r.type, h),
                t.utils.domNodeDisposal.addDisposeCallback(n, function () {
                    s[r.type]("destroy")
                }),
                u().$element = function () {
                    return s
                }
            },
            update: function (n, u) {
                var s = i(n),
                    h = t.mapping.toJS(u());
                s[r.type] && s[r.type](h)
            }
        },
            f = "easyui" + r.type.replace(/(^|\s+)\w/g, function (n) {
                return n.toUpperCase()
            });
        t.bindingHandlers[f] = u
    },
    t.createEasyuiInitBindings({
        type: "tree"
    }),
    t.createEasyuiInitBindings({
        type: "linkbutton"
    }),
    t.createEasyuiInitBindings({
        type: "tabs"
    }),
    t.bindingHandlers.inputwidth = {
        update: function (i, r) {
            var e = n(i),
                s = t.toJS(r()),
                h = function (t) {
                    var i = 1;
                    return typeof t == "string" && ((t.indexOf("px") > -1 || t.indexOf("PX") > -1) && (t = t.replace("px", "").replace("PX", "")), t.indexOf("%") > -1 && (t = t.replace("%", "") / 100)),
                    t > 0 && t <= 1 && (i = t, t = n(".val").width()),
                    t * i
                },
                o = function () {
                    var t = h(s);
                    n.each([{
                        selector: "input.z-txt",
                        handler: function (n) {
                            n.width(t - 8)
                        }
                    },
                    {
                        selector: "input[comboname],input.combo-f",
                        handler: function (n) {
                            n.combo("resize", t)
                        }
                    },
                    {
                        selector: "input[numberboxname].spinner-text",
                        handler: function (n) {
                            n.spinner("resize", t)
                        }
                    }], function () {
                        var n = e.find(this.selector);
                        n.length > 0 && this.handler(n),
                        e.is(this.selector) && this.handler(e)
                    })
                };
            o(),
            n(window).resize(o)
        }
    },
    t.bindingHandlers.autoheight = {
        update: function (t, i) {
            var e = n(t),
                f = i(),
                o = n.isFunction(f) ? f() : f;
            e.height(n(window).height() - o),
            n(window).resize(function () {
                e.height(n(window).height() - o)
            })
        }
    },
    t.bindingViewModel = function (i, r) {
        using("parser", function () {
            n.parser.onComplete = function () {
                t.applyBindings(i, r || document.body)
            }
        })
    }
} (jQuery, ko),
jQuery.fn.showLoading = function (n) {
    var s, t = {
        addClass: "",
        beforeShow: "",
        afterShow: "",
        hPos: "center",
        vPos: "center",
        indicatorZIndex: 99001,
        overlayZIndex: 99e3,
        parent: "",
        marginTop: 0,
        marginLeft: 0,
        overlayWidth: null,
        overlayHeight: null,
        message: "正在加载中，请稍候"
    },
        i, r, h, c, e, o, l, a, u, f, v;
    return jQuery.extend(t, n),
    i = jQuery("<div><\/div>"),
    r = jQuery("<div><\/div>"),
    s = t.indicatorID ? t.indicatorID : jQuery(this).attr("id"),
    jQuery(i).attr("id", "loading-indicator-" + s),
    jQuery(i).addClass("loading-indicator"),
    t.addClass && jQuery(i).addClass(t.addClass),
    jQuery(r).css("display", "none"),
    jQuery(document.body).append(r),
    jQuery(r).attr("id", "loading-indicator-" + s + "-overlay"),
    jQuery(r).addClass("loading-indicator-overlay"),
    t.addClass && jQuery(r).addClass(t.addClass + "-overlay"),
    e = jQuery(this).css("border-top-width"),
    o = jQuery(this).css("border-left-width"),
    e = isNaN(parseInt(e)) ? 0 : e,
    o = isNaN(parseInt(o)) ? 0 : o,
    l = jQuery(this).offset().left + parseInt(o),
    a = jQuery(this).offset().top + parseInt(e),
    h = t.overlayWidth !== null ? t.overlayWidth : parseInt(jQuery(this).width()) + parseInt(jQuery(this).css("padding-right")) + parseInt(jQuery(this).css("padding-left")),
    c = t.overlayHeight !== null ? t.overlayHeight : parseInt(jQuery(this).height()) + parseInt(jQuery(this).css("padding-top")) + parseInt(jQuery(this).css("padding-bottom")),
    jQuery(r).css("width", h.toString() + "px"),
    jQuery(r).css("height", c.toString() + "px"),
    jQuery(r).css("left", l.toString() + "px"),
    jQuery(r).css("position", "absolute"),
    jQuery(r).css("top", a.toString() + "px"),
    jQuery(r).css("z-index", t.overlayZIndex),
    t.overlayCSS && jQuery(r).css(t.overlayCSS),
    jQuery(i).css("display", "none").text(t.message),
    jQuery(document.body).append(i),
    jQuery(i).css("position", "absolute"),
    jQuery(i).css("z-index", t.indicatorZIndex),
    u = a,
    t.marginTop && (u += parseInt(t.marginTop)),
    f = l,
    t.marginLeft && (f += parseInt(t.marginTop)),
    t.hPos.toString().toLowerCase() == "center" ? jQuery(i).css("left", (f + (jQuery(r).width() - parseInt(jQuery(i).width())) / 2).toString() + "px") : t.hPos.toString().toLowerCase() == "left" ? jQuery(i).css("left", (f + parseInt(jQuery(r).css("margin-left"))).toString() + "px") : t.hPos.toString().toLowerCase() == "right" ? jQuery(i).css("left", (f + (jQuery(r).width() - parseInt(jQuery(i).width()))).toString() + "px") : jQuery(i).css("left", (f + parseInt(t.hPos)).toString() + "px"),
    t.vPos.toString().toLowerCase() == "center" ? jQuery(i).css("top", (u + (jQuery(r).height() - parseInt(jQuery(i).outerHeight())) / 2).toString() + "px") : t.vPos.toString().toLowerCase() == "top" ? jQuery(i).css("top", u.toString() + "px") : t.vPos.toString().toLowerCase() == "bottom" ? jQuery(i).css("top", (u + (jQuery(r).height() - parseInt(jQuery(i).height()))).toString() + "px") : jQuery(i).css("top", (u + parseInt(t.vPos)).toString() + "px"),
    t.css && jQuery(i).css(t.css),
    v = {
        overlay: r,
        indicator: i,
        element: this
    },
    typeof t.beforeShow == "function" && t.beforeShow(v),
    jQuery(r).show(),
    jQuery(i).show(),
    typeof t.afterShow == "function" && t.afterShow(v),
    this
},
jQuery.fn.hideLoading = function (n) {
    var t = {};
    return jQuery.extend(t, n),
    indicatorID = t.indicatorID ? t.indicatorID : jQuery(this).attr("id"),
    jQuery(document.body).find("#loading-indicator-" + indicatorID).fadeOut().remove(),
    jQuery(document.body).find("#loading-indicator-" + indicatorID + "-overlay").fadeOut().remove(),
    this
},
$.showLoading = function () {
    $("body").showLoading({
        overlayHeight: getsize().height
    })
},
$.hideLoading = function () {
    $("body").hideLoading()
},
easyuifix = {},
easyuifix.easyloader_addLoadModules = function (n) {
    $.extend(n, {
        juidatepick: {
            js: "/Content/js/jquery-plugin/jquery-ui/js/jquery-ui-datepick.min.js",
            css: "/Content/js/jquery-plugin/jquery-ui/css/jquery-ui.css"
        },
        daterange: {
            js: "/Content/js/jquery-plugin/daterange/jquery.daterange.js",
            css: "/Content/js/jquery-plugin/daterange/jquery.daterange.css",
            dependencies: ["juidatepick"]
        },
        extend: {
            js: "/Content/js/jquery-easyui-1.3.1/jquery.easyui.extend.js"
        },
        lookup: {
            js: "/Content/js/jquery-easyui-1.3.1/plugins/jquery.lookup.js",
            dependencies: ["combo"]
        },
        autocomplete: {
            js: "/Content/js/jquery-easyui-1.3.1/plugins/jquery.autocomplete.js",
            dependencies: ["combo"]
        }
    })
},
easyuifix.easyloader_setting = function (n, t) {
    n.theme = utils.getRequest("theme", t),
    n.locale = utils.getRequest("locale", t)
},
easyuifix.parser_addplugins = function (n) {
    var t = ["daterange", "lookup", "autocomplete"],
        i;
    for (i in t) n.push(t[i])
},
easyuifix.easyui_min_setIframeFree = function (n) {
    var t = $("iframe", n);
    t.length > 0 && (t[0].contentWindow.document.write(""), t[0].contentWindow.close(), t.remove(), $.browser.msie && CollectGarbage())
},
easyuifix.tabs_showtabonselect = function (n) {
    n.show()
},
easyuifix.lang_zh_CN = function () {
    $.fn.lookup && ($.fn.lookup.defaults.missingMessage = "该输入项为必输项")
},
easyuifix.datagrid_editors_checkboxVal = function (n, t) {
    return typeof t == "boolean" && $(n).val() == t.toString()
},
easyuifix.datagrid_beforeDestroyEditor = function (n, t, i) {
    var u = $.data(n, "datagrid").options,
        r, f;
    u.OnBeforeDestroyEditor && (r = {}, f = $(n).datagrid("getEditors", t) || [], $.each(f, function () {
        r[this.field] = this
    }), u.OnBeforeDestroyEditor(r, i, t, n))
},
easyuifix.datagrid_afterCreateEditor = function (n, t, i) {
    var u = $.data(n, "datagrid").options,
        r, f;
    u.OnAfterCreateEditor && (r = {}, f = $(n).datagrid("getEditors", t) || [], $.each(f, function () {
        r[this.field] = this
    }), u.OnAfterCreateEditor(r, i, t, n))
},
easyuifix.combo_disableToReadonly = function (n, t) {
    var r = $.data(n, "combo").options,
        i = $.data(n, "combo").combo;
    t ? (r.disabled = !0, $(n).attr("readonly", !0), i.find(".combo-value").attr("readonly", !0).addClass("readonly"), i.find(".combo-text").attr("readonly", !0).addClass("readonly")) : (r.disabled = !1, $(n).removeAttr("readonly"), i.find(".combo-value").removeAttr("readonly").removeClass("readonly"), i.find(".combo-text").removeAttr("readonly").removeClass("readonly"))
},
easyuifix.spinner_disableToReadonly = function (n, t) {
    var i = $.data(n, "spinner").options;
    t ? (i.disabled = !0, $(n).attr("readonly", !0).addClass("readonly")) : (i.disabled = !1, $(n).removeAttr("readonly").removeClass("readonly"))
},
easyuifix.datagrid_editor_extend = function () {
    $.fn.datagrid && ($.fn.numberspinner && $.extend($.fn.datagrid.defaults.editors, {
        numberspinner: {
            init: function (n, t) {
                var i = $('<input type="text">').appendTo(n);
                return i.numberspinner(t)
            },
            destroy: function (n) {
                $(n).numberspinner("destroy")
            },
            getValue: function (n) {
                return $(n).numberspinner("getValue")
            },
            setValue: function (n, t) {
                $(n).numberspinner("setValue", t)
            },
            resize: function (n, t) {
                $(n).numberspinner("resize", t)
            }
        }
    }), $.fn.autocomplete && $.extend($.fn.datagrid.defaults.editors, {
        autocomplete: {
            init: function (n, t) {
                var i = $('<input type="text" class="z-text datagrid-editable-input">').appendTo(n);
                return i.autocomplete(t)
            },
            destroy: function (n) {
                $(n).autocomplete("destroy")
            },
            getValue: function (n) {
                return $(n).val()
            },
            setValue: function (n, t) {
                $(n).val(t)
            },
            resize: function (n, t) {
                $(n).width(t)
            }
        }
    }), $.fn.lookup && $.extend($.fn.datagrid.defaults.editors, {
        lookup: {
            init: function (n, t) {
                var i = $('<input type="text" class="z-text datagrid-editable-input">').appendTo(n);
                return i.lookup(t)
            },
            destroy: function (n) {
                $(n).lookup("destroy")
            },
            getValue: function (n) {
                return $(n).lookup("getValue")
            },
            setValue: function (n, t) {
                $(n).lookup("setValue", t)
            },
            resize: function (n, t) {
                $(n).lookup("resize", t)
            }
        }
    }), $.extend($.fn.datagrid.defaults.editors, {
        label: {
            init: function (n) {
                return $("<div><\/div>").appendTo(n)
            },
            destroy: function () { },
            getValue: function (n) {
                return $(n).html()
            },
            setValue: function (n, t) {
                $(n).html(t)
            },
            resize: function () { }
        }
    }))
}